Getting transaction id from raw transaction of a multisig address I am able to get the tx id (or transaction hash) of almost any transaction but the one where the script starts with an "OP_O" (which is, I think, the null dummy introduced here https://github.com/bitcoin/bitcoin/pull/3843)

For example:

https://www.blockchain.com/btc/tx/97d1b00fcef1f19531a19bb1722635341a9f2ad261ecf6eed89eca2cbd3bb3ee

How am I suppose to get the txid of this transaction? And how is it different from a regular (without multisig) one?

How am I suppose to get the txid of this transaction?

The same way you get the txid of any other transaction, by hashing it (unless it is segwit). Note that the transaction you linked to is not a segwit transaction, so you can just take its hash.

If the transaction is a segwit transaction (as indicated by the marker and flag bytes of 0x0001 following the version bytes), then you need to only hash the parts that are non-segwit. Specifically, you drop all of the segwit parts (so the marker and flag and any witnesses which can be found between the last output and the locktime), and hash what is left. This is described in BIP 144.

  And how is it different from a regular (without multisig) one?

There isn't.


Signing a transaction with openSSL I've read a bit about signing a transaction using openSSL, I've tried implementing it but it seems like the signatures generated are not accepted. So I'm wondering if the following commands provide a valid signature.

Let's create a private key: dd1cd59c4de2fa92e363dac282afe790a5193177d413b38e206b2b86b879ffbf
And generate a testnet public address: mhZQtrhzjqkDmm8yp8jR2D84AagCdL4YzM
And send some testnet btc to it: a05f60a9679a1ad0ef57b092006b6c01886291a2ff696f5e2ac107b349594cf6

We will create a transaction that sends the BTC to 2N8hwP1WmJrFF5QWABn38y63uYLhnJYJYTF.

Okay, so the unsigned raw transaction is:

01000000
01
f64c5949b307c12a5e6f69ffa2916288016c6b0092b057efd01a9a67a9605fa0
00000000
19
166749c16df955750990623397be66e965863611
ffffffff
01
70508e0600000000
1976a914a9974100aeee974a20cda9a2f545704a0ab54fdc88ac
00000000
01000000

We double hash the raw transaction: 372f7f092abc73c2bcd357ec2b0dab4a9fdbb956771c676cf92a899feedcda0a.
And create a PEM key for openSSL (30740201010420 . private_key . a00706052b8104000aa144034200 . public_key and base64 it):

-----BEGIN EC PRIVATE KEY----- MHQCAQEEIN0c1ZxN4vqS42PawoKv55ClGTF31BOzjiBrK4a4ef+/oAcGBSuBBAAK oUQDQgAEnQ9w7thTRcpcHARWO+0ZYIViw31kQGF4WoNujxmRVfKBih4mYfntUB2P kGYRiSCZqd5afqn2Qey03XW7tjwtWg==
-----END EC PRIVATE KEY-----

And then I use the following command to create the DER sig: echo "372f7f092abc73c2bcd357ec2b0dab4a9fdbb956771c676cf92a899feedcda0a" | openssl dgst -sha256 -hex -sign key.pem.

Adding the length byte and public key, we end up with the following scriptSig: 46 304402203c8aaa41ae647149f70ce24f73109e99d59d7e54a5d854239943358d581e9f8302206336cb57c00bb78f46c881b3d6bb2ed76dc652eedf36064ae022ea4ae3ba3b100141049d0f70eed85345ca5c1c 04 563bed19608562c37d644061785a836e8f199155f2818a1e2661f9ed501d8f906611892099a9de5a7ea9f641ecb4dd75bbb63c2d5a.

Great. This leaves us with the following raw transaction:

01000000
01
f64c5949b307c12a5e6f69ffa2916288016c6b0092b057efd01a9a67a9605fa0
00000000
8a
47304402203c8aaa41ae647149f70ce24f73109e99d59d7e54a5d854239943358d581e9f8302206336cb57c00bb78f46c881b3d6bb2ed76dc652eedf36064ae022ea4ae3ba3b100141049d0f70eed85345ca5c1c04563bed19608562c37d644061785a836e8f199155f2818a1e2661f9ed501d8f906611892099a9de5a7ea9f641ecb4dd75bbb63c2d5a
ffffffff
01
70508e0600000000
1976a914a9974100aeee974a20cda9a2f545704a0ab54fdc88ac
00000000

Which is unfortunately not a valid transaction (error received: PUSH TRANSACTION ERROR: 16: MANDATORY-SCRIPT-VERIFY-FLAG-FAILED (OPCODE MISSING OR NOT UNDERSTOOD)).

Using a transaction tool, I get the following (valid) raw transaction, which I was able to redeem:

01000000
01
f64c5949b307c12a5e6f69ffa2916288016c6b0092b057efd01a9a67a9605fa0
00000000
8a
47304402204cdb6499578276106748c4877bf2a3381ba484fb621ce8d3faa2161254bdeec902205e3536aeaa65f8f0f55b3eb31a9bf8959b70e247c0ebd9da485e586370a25b900141 049d0f70eed85345ca5c1c04563bed19608562c37d644061785a836e8f199155f2818a1e2661f9ed501d8f906611892099a9de5a7ea9f641ecb4dd75bbb63c2d5a
ffffffff
01
70508e0600000000
1976a914a9974100aeee974a20cda9a2f545704a0ab54fdc88ac
00000000

All the fields are correct besides the signature. How come the openSSL signing command I used was incorrect?

Is the signature generated valid? Is the openSSL command valid? Can we even use openSSL to sign a transaction?

While I haven't verified the signature, upon inspection of the encoding I think I can see what is wrong. Let's break down the scriptSig briefly and I'll show you:

8a (total number of bytes to follow)
46 (the signature is 0x46 bytes long *THIS IS WHERE THE ISSUE IS*)
30 (compound DER type)
44 (0x44 bytes following)
02 (integer type)
20 (0x20 bytes long)
3c8aaa41ae647149f70ce24f73109e99d59d7e54a5d854239943358d581e9f83 (R value)
02 (integer type)
20 (0x20 bytes long)
6336cb57c00bb78f46c881b3d6bb2ed76dc652eedf36064ae022ea4ae3ba3b10 (S value)
01 (SIGHASH_ALL sighash type)
41 (length of public key is 0x41 bytes)
049d0f70eed85345ca5c1c04563bed19608562c37d644061785a836e8f199155f2818a1e2661f9ed501d8f906611892099a9de5a7ea9f641ecb4dd75bbb63c2d5a (public key)

Now I've highlighted the length of the DER encoded signature as the issue - 46. This should be 47. The reason is that that length is actually supposed to be the length of the signature plus one byte for the sighash type. Unlike normal DER signature produced by OpenSSL, Bitcoin requires the sighash type to be appended, in this case 01 for SIGHASH_ALL. You can see the 01 byte present. But you haven't updated the length. In the valid transaction below it, on the other hand, you can see the length is 47 despite the fields being the same length.

So try updating the 46 to a 47 and see if it works :)


transaction inputs does not have prev_out field I found some transaction inputs does not contain prev_out field, i.e. it does not have input address. It only has an output address. Does this mean this kind of transactions records the activities of mining new coins?

e.g.

'tx': [{'hash': '2b1f06c2401d3b49a33c3f5ad5864c0bc70044c4068f9174546f3cfc1887d5ba', 'inputs': [{'script': '04ffff001d0138', 'sequence': 4294967295, 'witness': ''}], 'lock_time': 0, 'out': [{'addr': '1HwmP33SaknLYShXfjVU8KmVThU3JiuVgH', 'n': 0, 'script': '41045e071dedd1ed03721c6e9bba28fc276795421a378637fb41090192bb9f208630dcbac5862a3baeb9df3ca6e4e256b7fd2404824c20198ca1b004ee2197866433ac', 'spent': False, 'tx_index': 15066, 'type': 0, 'value': 5000000000}],

while for another transation:

{'hash': 'ee475443f1fbfff84ffba43ba092a70d291df233bd1428f3d09f7bd1a6054a1f', 'inputs': [{'prev_out': {'addr': '1CfD77hupeUvFwBPxZ2fA8iyWmVwQY22oh', 'n': 1, 'script': '76a9147fe34b97aeff4ab754770be5c8f12e2e95332fd488ac', 'spent': True, 'tx_index': 8845778, 'type': 0, 'value': 10212000000}, 'script': '483045022100e5e4749d539a163039769f52e1ebc8e6f62e39387d61e1a305bd722116cded6c022014924b745dd02194fe6b5cb8ac88ee8e9a2aede89e680dcea6169ea696e24d52012102b4b754609b46b5d09644c2161f1767b72b93847ce8154d795f95d31031a08aa2', 'sequence': 4294967295, 'witness': ''}], ...

the second one has a prev_out field while the first one does not

Transactions without prev_outs are known as coinbase transactions (not to be confused with transactions from the company named Coinbase) or coin generation transactions. They create outputs without needing any inputs to the transaction. Coinbase transactions are special transactions which are created miners and included as the first transaction in a block. They are what pays miners for their work.

There can only be one coinbase transaction per block, and it must be the first transaction of the block. The sum of the outputs must also meet certain constraints: it can be no more than the sum of the block subsidy and the sum of the transaction fees paid by all transactions in the block.


What node implementations and mining pools relay and process 'non-standard' scripts? Which Bitcoin node implementations, if any, currently relay valid transactions that use so-called 'non-standard' scripts? What proportion of the network is made up of these implementations? What proportion of the network's hashing power will include transactions with valid but 'non-standard' scripts in their blocks?

To clarify the term 'non-standard', I'm referring to the function IsStandard(), and the following comment on the Bitcoin Wiki:

  non-standard scripts are accepted if they are in a block, but nodes will not relay them.

There is [old] bitcoin version by Lukejr
http://eligius.st/~luke-jr/programs/bitcoin/files/bitcoin-qt/next/test/20130721/
It accepts and relays non-standard transactions running with commandline option "-acceptnonstdtxn"

It is very unstable program, use it with separate database and empty wallet.dat
But it definetely works.

There is at least one pool, which accepts non-standard transactions
It is eligius.st
Its public IP-address is 192.3.11.20
Just add option "connect=192.3.11.20" in your conf file or commandline param and you are a part of "non-standard relaying network"

for more information refer to
https://bitcointalk.org/?topic=260749


Validate Bitcoin address using Javascript I know there is a similar question but its 7 years old and the answer doesn't work. Now, many things have changed, including the addresses themselves. So, is there a js library I can trust that can validate addresses on 2021

Use bitcoinJS's https://github.com/bitcoinjs/bitcoinjs-lib/blob/27a840aac4a12338f1e40c54f3759bbd7a559944/src/address.js#L101 toOutputScript function in a try-catch block


Bitcoind fails to start on Centos 7 When I execute bitcoind on CentOS 7 I get this error:

Unable to start HTTP server. See debug log for details.
 bitcoind: scheduler.cpp:19: CScheduler::~CScheduler(): Assertion `nThreadsServicingQueue == 0' failed.

There are a number of known issues on the compile side of things (under CentOS) which could be related: https://github.com/bitcoin/bitcoin/issues/6432.


How to structure a Bitcoin charity miner? I'm working on a project involving mining Bitcoins for charity. I'm writing my own miner, and though I may eventually set up my own pool for this purpose, for now I'm planning on using existing pools.

My question is: how can I set up the miner so that people can use it to mine toward my organization's Bitcoin address (if having a single address is even the right approach to take), without exposing this address to theft from anyone who reads the credentials from the miner's getwork requests? My understanding is that the HTTP Basic Auth used in getwork requests doesn't pass values in a safe way.

As is probably evident from this question, I'm generally pretty fuzzy on how wallets interact with payouts from mining pools and/or Bitcoins stored in accounts with said pools, so any explanation there would also be greatly appreciated.

You can give someone the necessary credentials to mine on your behalf without them gaining access to the bitcoins. Pools don't use the worker passwords sent with getwork for logging into the website and controlling where coins are sent. They are used only for fetching work and delivering the results.

As you say, basic auth over unencrypted HTTP is already unsafe handling of the worker passwords. You have to assume that those passwords are compromised anyway.

I think the most damage someone can do is to overload a pool server using your worker credentials. I suppose this could get your account temporarily banned, but I'm sure a pool operator would be understanding in this case. I've never heard of anything like that happening either.


Running a full node VS mining I read the following on bitcoin.org

A full node is a program that fully validates transactions and blocks.
Almost all full nodes also help the network by accepting transactions
and blocks from other full nodes, validating those transactions and
blocks, and then relaying them to further full nodes.
Most full nodes also serve lightweight clients by allowing them to
transmit their transactions to the network and by notifying them when
a transaction affects their wallet. If not enough nodes perform this
function, clients won’t be able to connect through the peer-to-peer
network—they’ll have to use centralized services instead.
Many people and organizations volunteer to run full nodes using spare
computing and bandwidth resources—but more volunteers are needed to
allow Bitcoin to continue to grow. This document describes how you can
help and what helping will cost you.

In some ways it sounds like they are describing mining when they say "validating those transactions and blocks", but I also believe running a full node is different than mining. In what way is running a full node help the bitcoin network? Does it just help transfer information about transactions that have been processed by miners?
If running a full node is in fact distinct from mining, what incentive do people have to run full nodes if they aren't able to earn the reward as a miner would. Is it just for bitcoin supporters who want to help bitcoin grow?

If running a full node is in fact distinct from mining, what incentive do people have to run full nodes if they aren't able to earn the reward as a miner would. Is it just for bitcoin supporters who want to help bitcoin grow?

Incentives to run and use a bitcoin full node:

Not trusting anyone, verifying everything.

Privacy. Not sharing information about your transactions with others.

Enforce consensus rules.


How to derive segwit addresses from an extended public key? I tried to use the following code:

    DeterministicKey key = DeterministicKey.deserializeB58(null , "xpub...", MAINNET);

    DeterministicHierarchy hierarchy = new DeterministicHierarchy(key)
;
    DeterministicKey chain = hierarchy.deriveChild(key.getPath(), false, false, new ChildNumber(0, false));
    DeterministicKey index = hierarchy.deriveChild(chain.getPath(), false, false, new ChildNumber(0, false));
    SegwitAddress segwitAddress = SegwitAddress.fromHash(MAINNET, index.getPubKeyHash());

But it doesn't return correct address.
Any help here

Zpub's would be needed for native segwit addresses. And current bitcoinj master branch does not support Zpub, it support xpub and xpub's would always derive to
legacy addresses. Give a try to Segwit branch that may helps. Also take a look at this


Why can't I get any miner to work on my PC? I've tried BFGminer, CGminer, and GUIminer. I'm registered on Slush's Pool. I can't get BFGminer.exe to even open though and GUIminer refuses to connect to Slush's Pool even if I manually put in the new address. I have no idea what I'm doing wrong. Can someone please help me? I'm super new to this if you can't tell.

You cannot mine Bitcoin on a desktop (or laptop) computer these days.  If you are trying to mine Bitcoin on Slush, you will need an ASIC.  You can potentially mine ZCash on Slush, if you have a high performance graphics card.  Slush does not support directly mining any other coins.


What is the variable valertpubkey in net.cpp for? vAlertPubKey = ParseHex("04fc9702847840aaf195de8442ebecedf5b095cdbb9bc716bda9110971b28a49e0ead8564ff0db22209e0374782c093bb899692d524e9d6a6956e7c5ecbcd68284");

The vAlertPubKey variable can be seen in the initialisations for main and test network, but not for regtest. Can someone explain what it exactly means and how will it affect me if I want to simulate a network of 1000 or more nodes on a private network in regtest mode ?

One of the people who holds the private key corresponding to that public key (Satoshi, theymos, Gavin, and unspecified others) has the ability to send a message out to everyone on the network. This has been used in the past to tell people about security vulnerabilities in the client.

  Can someone explain what it exactly means and how will it affect me if I want to simulate a network of 1000 or more nodes on a private network in regtest mode ?

Assuming you're not testing the alert system, it won't affect you.


Why are ardor transactions called via the api not in chronological order by timestamp? When retrieving data from the Ardor api, why is the data returned not in chronological order?

The results are first ordered by the score which Apache Lucene assigns to them . If two results get same score, they are ordered by blockTimestamp, descending (what happens with the 2nd, 3rd and 4th result in your data).

Apache Lucene is configured with the default BM25Similarity with parameters k1 = 1.2 b = 0.75, i.e. Ardor uses the default scoring function. More details about that function can be found here. The query parser is configured with default operator AND, so if your query contains two words, they must both be present in order for the data to be included in the result


Can bitcoins be exchanged for nonlicensed "Professional" services? Can Bitcoins be exchanged for professionally licensed services by persons who are NOT licensed? For those folks, receiving cash would normally be a Blackmarket Racket since only licensees, the governments approved vendors, may partake in those business activities.

Persons can dispense all sorts of professional services as long as they aren’t for "business" or "pay".  Good hearted family, friends, neighbors and colleagues do it all the time. It’s a basic freedom we as Americans understand, to not be controlled like individuals were in the USSR etc.

Hypothetically, if neighborA were to dispense Legal Advice for PAY, yet NOT be a licensed attorney, then neighborA would be involved in an illegal operation according to political regulations.  NeighborA, however, could in fact give that same advice, and on any other matter they like...taxes, medical, legal etc., as long as they DON’T do it for business.

So, can these folks legally receive bitcoins?  Or, is that considered Pay and Business?

Persons can dispense all sorts of professional services as long as they aren't for "business" or "pay"

In some places, yes. In other places, no. Since you didn't specify your jurisdiction, I will guess that you live in Alabama. Alabama Code - Section 34-3-6 (b) defines the practice of law this way:

Whoever,
(1) In a representative capacity appears as an advocate or draws papers, pleadings or documents, or performs any act in connection with proceedings pending or prospective before a court or a body, board, committee, commission or officer constituted by law or having authority to take evidence in or settle or determine controversies in the exercise of the judicial power of the state or any subdivision thereof; or
(2) For a consideration, reward or pecuniary benefit, present or anticipated, direct or indirect, advises or counsels another as to secular law, [...] or
[2 lines snipped.]

For example, if you help your neighbor write up their will, and you weren't a licensed lawyer, you could potentially be in violation of this section, even if you never received any money.

Hypothetically, if neighborA were to dispense Legal Advice for PAY, yet NOT be a licensed attorney, then they'd be involved in an illegal operation according to political regulations. [...] can these folks legally receive bitcoins? Or, is that considered Pay and Business?

Well, the IRS thinks that Bitcoins are money. Various state-level tax agencies think that Bitcoins are money. I'd guess that Bitcoins received for legal advice would probably be considered 'pay.'
As for dispensing medical advice...

Van Thiel claimed he performed abortions, removed sebaceous cysts, treated sexually transmitted and life-threatening diseases and provided ozone treatments at “unbeatable prices” in exchange for Bitcoins, gold and silver and firearms.

There has been someone who was prosecuted for unlicensed practice of medicine in exchange for Bitcoin.


Orphan block payment maturity I know that the outputs coinbase transaction can be spent only after receiving 100 confirmations.
So is it that a miner who mined an orphan block receives the outputs of coinbase transaction but can never spend them?
In such a case the number of bitcoins in circulation would reduce overtime due to creation of orphan blocks.
If your answer is that a miner doesn't get paid for orphan block, when will a miner get the block reward , is it after 100 confirmations?
But if he gets the block reward after 100 confirmations, the coinbase transaction would have been created at the time of creation of the block itself right, so what about it?

So is it that a miner who mined an orphan block receives the outputs of coinbase transaction but can never spend them?

Kind of.

  In such a case the number of bitcoins in circulation would reduce overtime due to creation of orphan blocks.

No, that's not how miners are paid.

Miners are essentially paid by themselves; they are allowed to produce coins out of thin air in the coinbase transaction. There is not some central money supply that the coins come from that pays coins to miners for creating a block.

When an orphan block is mined, the coinbase transaction is basically forgotten. The coins it produces never go into circulation and don't actually exist. Instead they are "replaced" by the block that was accepted by the rest of the network. So no coins are lost.

It's not that the transaction exists and the miner can't spend from it. Rather the transaction doesn't exist (it isn't in the main chain, so to the network it doesn't exist) so the miner can't spend from it. Because it is not part of the main chain it has no effect on Bitcoin's money supply.


How to calculate a hash of a Tx? How does one calculate the hash of a Tx? Which fields need to be double SHA hashed and in what order?

As explained by Gavin Andersen on the forum - in order to calculate the ID hash of the Tx that is used in the Merkle Tree, one needs to SHA hash the whole Tx message as defined in the Protocol Specification wiki page twice.

For example, for the only Tx from the Genesis Block one would double hash the following array of bytes:

01000000010000000000000000000000000000000000000000000000000000000000000000FFFFFFFF4D04FFFF001D0104455468652054696D65732030332F4A616E2F32303039204368616E63656C6C6F72206F6E206272696E6B206F66207365636F6E64206261696C6F757420666F722062616E6B73FFFFFFFF0100F2052A01000000434104678AFDB0FE5548271967F1A67130B7105CD6A828E03909A67962E0EA1F61DEB649F6BC3F4CEF38C4F35504E51EC112DE5C384DF7BA0B8D578A4C702B6BF11D5FAC00000000

And if double hashed correctly, it would give the following hash:

4A5E1E4BAAB89F3A32518A88C31BC87F618F76673E2CC77AB2127B7AFDEDA33B


How is 'profitability' calculated on Coinotron? On the Coinotron, multi-currency pool website, there is a metric posted at the top-right of each page that displays how "profitable" it is to mine a specific currency.

How does Coinotron derive this value?

It divides the block rewards given multiplied by the value of the currency in USD by the difficulty to generate a this same reward on each cryptocurrency.


How to recover an electrum wallet from seed A service I used some years ago is shutting down. I withdrew some coin but it went to an old address. I believe it was my old electrum wallet that I only have the seed for. How to recover my bitcoin?

First download Electrum, try to get a version closest to the one you were using. Get the portable version because you may need to get a higher version if it doesn't work.

Open the program, File -> new/restore -> enter in your seed when asked.

When it asks for a password, it means a new password to save this wallet with encryption.

Then wait for the syncing to happen.


If a block contains no SegWit transactions, does a miner send an (empty) witness? Also, would that block's Coinbase contain some kind of empty witness commitment?

BIP141 only requires a commitment to the witness tree to be present when there is at least one segwit transaction (= a transaction that spends a witness output) in the block.

This means that old miners in theory can keep working after segwit activates, as long as they don't include segwit transactions (easy, as they are nonstandard to them) and don't build on top of invalid blocks (harder, as it requires an updated full node).


What do all of the items in the output from p2pool mean? 2012-08-15 10:57:04.728547 P2Pool: 17401 shares in chain (9127 verified/17405 total) Peers: 11 (0 incoming)
2012-08-15 10:57:04.728781  Local: 1689MH/s in last 10.0 minutes Local dead on arrival: ~3.8% (2-8%) Expected time to share: 29.8 minutes
2012-08-15 10:57:04.728886  Shares: 3 (1 orphan, 0 dead) Stale rate: ~33.3% (6-80%) Efficiency: ~73.5% (22-104%) Current payout: 0.0174 BTC
2012-08-15 10:57:04.728999  Pool: 415GH/s Stale rate: 9.3% Expected time to block: 6.3 hours

Most of it is evident, but if someone could give a breakdown, that would be very helpful.

P2Pool: 17401 shares in chain (9127 verified/17405 total) Peers: 11 (0 incoming)

This means that P2Pool knows of 17405 shares, 9127 of which have been verified (indicating that you haven't been running p2pool for more than 24 hours), and 17401 of which are in the selected chain (meaning that there have been 4 orphaned shares globally in the past few minutes).

Local: 1689MH/s in last 10.0 minutes Local dead on arrival: ~3.8% (2-8%) Expected time to share: 29.8 minutes

You have 1689MH/s mining, with 3.8% of shares invalid due to latency between P2Pool and the miner. It's expected that you'll get your next share in half an hour.

Shares: 3 (1 orphan, 0 dead) Stale rate: ~33.3% (6-80%) Efficiency: ~73.5% (22-104%) Current payout: 0.0174 BTC

You found 3 shares, one of which was orphaned (33.3% of them), indicating that your normal stale rate if you continue falls between 6% and 80%, with 95% confidence. Your efficiency is 73.5%, meaning that you'll only get 73.5% of what you should, based on your stales, though in the future, the true value will fall between 22% and 104% with 95% confidence, so there's no evidence currently that something is wrong (since 100% is in that interval).

Pool: 415GH/s Stale rate: 9.3% Expected time to block: 6.3 hours

The pool has a total of 415GH/s of hashing power, and 9.3% of discovered shares aren't integrated into the sharechain. It's expected that we'll get a block in 6 hours.


Move bitcoins from one address to another using JSON RPC I am developing a website where each user has a unique bitcoin address and each user can receive or send money. I have a bitcoin node running, so I connect to it to run json-rpc api calls.

The problem which I have is the following:
If one user has 1BTC and send 0.5BTC to the external wallet. I want that the user has 0.5 BTC in his wallet but right now with sendtoaddress api call the 0.5 BTC remaining aren't in the original wallet, the 0.5 BTC is moved to a new address from the wallet.

I don't see right now how can achieve it through json-rpc calls, if someone could help I'd be grateful!

The leftover 0.5 BTC is sent to a change address because it is not good practice to reuse addresses.  You would simply have to assign the change addresses to the users.


Sending bitcoin from Bitcoin-QT v0.6.2.2 wallet I bought a couple of bitcoin in 2012 where they languished on my successive Mac Book Pros in a Bitcoin-QT v0.6.2.2 wallet.  I now realise they are worth - ahem - something!  The wallet still fires up even though it is still calls itself a beta wallet and so I thought I would first try to send my lovely bitcoin to a new and glossy Exodus wallet.

Now being completely new to this I got my receive address for my Exodus Wallet and tried sending 0.1 BTC to my Exodus wallet. Eventually (maybe 5 hours later) it showed it had arrived but with zero confirmations. This first transaction still shows with 0.1 BTC "Pending" in the Exodus Wallet (sent Friday Dec 1st 10.04.10 PM).

I realised I had not included any fee on this first send but  I didn't see anything I could do about that.

Anyway I then sent the balance of BTC in my Bitcoin-QT wallet, but this time included a 0.0004 BTC fee to the same address.  But, 34 hours later it does not even show it having arrived at the Exodus wallet.

Now I really do not know what to do.  I assume if I leave my Bitcoin-QT wallet up and running it will keep broadcasting the transactions and so they may never disappear. So I have quit the wallet.  But suppose I leave it for a few days. If I fire up the wallet then I assume it will broadcast again and I will be back in the same situation?  I could start it up offline and restore from a backup I did just prior to sending the first transaction - I guess that would cut out the re-broadcasts.  Would that be the thing to do?

The Bitcoin wallet reports that the Transaction Ids are:

(Second transaction with 0.0004 BTC fee):

60efa66a8aef482cc3f2ce2ae348427e74feb12db91b579ed4c7ea955fbea0bf

(First transaction with fee not added :-(:

a0a70213c2e94119357cdac865e404e1ca6f44cf40a4acf9a6e272d4f0dd3f21

However when I put those into https://blockchain.info/ I am told the transaction does not exist. The same with ViaBTC Transaction accelerator.

I don't know exactly what features are available on your version, but here are some ideas to try.

First, take a backup of your wallet.dat file.

In the debug window (help menu?), make sure that your peer is actually connected to some other peers so that your transaction will be broadcast to the network.
Make sure your node is fully synced to the latest block.
Start the application with the -zapwallettxes=1 argument to delete the transactions that are not in the blockchain from your wallet.
Start again with the -rescan argument to scan the blockchain for bitcoins assigned to your private keys. This will take a long time (hours possibly).
Your bitcoins should be available again, so try to send the transaction again with a higher fee. You can use https://bitcoinfees.earn.com/ to decide what an appropriate fee is.

If you really want to export your private keys, you can use the dumpprivkey "address" command from the console inside the debug window (if the console is available in your version). But be very careful when moving your private keys around, they could get stolen by a key logger, screen grabber, other malware, or phishing sites, etc.


What happens to my bitcoins if a hard fork occurs? It seems that on August 1st, there will be a hard fork on Bitcoin. This will mean that instead of 1 coin we will end up with 2.

Without going into the discussion about whether it will or not occur.

What happens if I had, 10 Bitcoins before, will I have 10 bitcoinsA and 10 bitcoinsB?

Does this depend exclusively on the exchange I am with? What if my bitcoins are on a paper wallet? How does this aspect work?

Technically, the UASF that will go live on August 1st isn't a hardfork (see What is the User Activated Softfork (UASF) proposal? How do its risks compare to hardforks?), but it may have still have a chainsplit.

When there is lack of consensus about the rules in the bitcoin network, there may be multiple blockchains, one blockchain following one set of rules, one following another. These two chains share the beginning of their chains, but there is a distinct point in time where they diverge. If the transaction where you received bitcoins happened before that point in time where they diverged, then your coins will be in both chains, so no matter which one is eventually selected, you'll be on the 'winning' side.

I should note that a chain split isn't necessarily ever resolved. There might be two ecosystems and networks that build around 2 different chains. In this case, your pre-split coins are available on both chains, and you could even spend them twice, once with one merchant on one side of the chain split and once with another merchant who is on the other side of the chain split!

The risk mainly comes in when you make transactions after a chain split. For example, if you are a merchant and you accept coins on side A of the chain split, but that transaction doesn't also get included on the other chain (side B), then sometime later the network gets back to consensus that chain B is the correct chain, then your coins on chain A are worthless. So it is risky to accept payment while the network lacks consensus.


Where is the data folder for Bitcoin-Qt? Where can I find the blockchain, wallet.dat, etc. on each of the operating systems Bitcoin-Qt supports?

It is the same data folder as the non-QT version of the standard client used to use:

Linux:

~/.bitcoin/

MacOS:

~/Library/Application Support/Bitcoin/

Windows:

%APPDATA%\Bitcoin

(This defaults to C:\Documents and Settings\YourUserName\Application data\Bitcoin on Windows XP and to C:\Users\YourUserName\Appdata\Roaming\Bitcoin on Windows Vista, 7, 8, and 10.)


Can the blockchain ever be restarted? Since full nodes must store the entire blockchain, and it seems to currently be 9 gb in size, it seems that sooner or later, it will be too large to handle ( if 9gb isn't already absurdly large ).  Is there no provision to ever restart the chain?  Certainly it can't just keep growing for all time?

It seems to me that sooner or later, a second genesis block will have to be created and unspent transactions will need to be converted from the first generation, then new transactions to the first genesis rejected, before finally discarding the first chain once all unspent transactions have been converted.

That's probably not gonna happen. The only way restarting the block chain without losing the distribution of coins would be by hard coding all the unspent outputs from the moment of the reset in all Bitcoin clients.

If you say

  Certainly it can't just keep growing for all time?

Why can't it? If the block chain grows at a slower pace that the price of storage, which can be predicted by Moore's law, why would it matter? Also, Bitcoin will probably evolve to a situation where not every user will have to keep in sync, but will use a service wallet or another payment network backed by Bitcoin so that it doesn't need the data.

Also, old blocks can be compressed when you don't use them, so the blockchain size can be reduced a little if it becomes really big.


People who don't broadcast their IP address? At https://bitcoin.stackexchange.com/a/9807/5228 Tom van der Woerdt wrote "people who don't broadcast their IP address".

What did he mean by that? Is there a way to set up a particular Bitcoin client so that it does not broadcast my IP address or to make it more private in other ways?

Sure. Install Tor and add tor=1 to your bitcoin.conf.


Sending lightning payment between TOR lighning nodes, any specific setup required? I have two c-lightning nodes in different VMs in Qubes OS, both routed through TOR VM.
They both can connect to other public nodes and establish channels with them but when I try sending satoshis between them the sending node gives "Could not find a route" code 205 right away, like it's not even trying.
At the same time in the terminal where lightningd is running I get:
20-07-01T12:46:17.482Z DEBUG gossipd: REPLY WIRE_GOSSIP_GETCHANNELS_REPLY with 0 fds
2020-07-01T12:46:17.484Z DEBUG gossipd: Trying to find a route from (me) to 0xxx_ID_EDITEDOUT_XXX for 40000000msat
2020-07-01T12:46:17.484Z DEBUG gossipd: REPLY WIRE_GOSSIP_GETROUTE_REPLY with 0 fds

Is it possible the problem for that to be related to TOR, considering that I can connect to and open channels with public nodes just fine?
I haven't opened direct channel between the nodes, since I want to play with routing.
But each of those nodes has established channel with some of the most well connected nodes, so route exist for sure.

Is it possible the problem for that to be related to TOR, considering that I can connect to and open channels with public nodes just fine?

No, that's very unlikely. (and contradictory)
Are the channels you created announced ?
Are your two nodes connected to the network ? For a node to find a route it needs to be connected to the peer-to-peer network to trade gossip and build its view of the current state of the network (opened channels and whether they are active).
Without this information there is nothing for it to search routes in.
You can verify that your channels are announced with listpeers (the channels array), or by running listchannels <scid> on your first node (with scid the short channel id of a channel of your second node).
If listchannels returns an empty array you need to connect to some public nodes and wait for your node to sync gossip with the rest of the network.
Finally, as it'll surely be your next concern: be sure to have incoming capacity in at least one of your second node's channel :-).


The use of Bloom filter in SPV nodes I know what Bloom Filter (BF) is, and I'm aware of this post and this paper. But I don't understand how it's used in bitcoin.

I can imagine that an SPV node encodes the transaction(s) it's interested in, into a BF and sends it to full node. What I don't understand is that what does the full node do after that?

Does it traverse through all the previous transactions and check which one is in the BF and sends it to the SPV node?

Also, it's not clear how private the approach would be, because at the end the full node retrieves what the SPV node wants and sends it to the node, so it knows what it's interested in.

If the goal is to preserve the privacy of the SPV's query, then some sophisticated approaches such as private information retrieval or oblivious ram must be used but they are not efficient for the bitcoin setting.

I can imagine that an SPV node encodes the transaction(s) it's interested in, into a BF and sends it to full node. What I don't understand is that what does the full node do after that?

The full node goes through every transaction on the blockchain. (Or, at least, every transaction that happened after the wallet was created.) It checks the following things against the bloom filter.

  Test the hash of the transaction itself.
  For each output, test each data element of the output script. This means each hash and key in the output script is tested independently. Important: if an output matches whilst testing a transaction, the node might need to update the filter by inserting the serialized COutPoint structure. See below for more details.
  For each input, test the serialized COutPoint structure.
  For each input, test each data element of the input script (note: input scripts only ever contain data elements).
  Otherwise there is no match.

(Source.)

If it matches, it's sent to the SPV node. The SPV node discards the false positives.

  If the goal is to preserve the privacy of the SPV's query, then some sophisticated approaches such as private information retrieval or oblivious ram must be used but they are not efficient for the bitcoin setting.

I don't know of any private protocol that doesn't require the full node to scan through the entire blockchain for every request.

If you know of one, let me know. :) Always interested to hear about that kind of thing.


Is it possible for the transaction to be on hold forever? I'm playing around with myst wallet on a private network, and noticed this option while sending funds between wallets:

This is ETH, but I'm also interested how other networks handle this issue.

So I started to wonder - is it possible that in abundance of high fee transactions to add (mine), my transaction would never be applied to a block? In a similar fashion like low priority processes can get starved?

Or maybe there is some mechanisms that will ensure that my transaction gets through?

I can imagine such mechanism like this: each miner has to pick at most 90% transaction with high fee, and 10% transactions with low fee. This way - low fee queue can get clogged, but if it's a FIFO queue - those would be processed eventually.
As opposed to the approach where take X transactions ordered by fee desc would allow to high fee transactions to flow in virtually starving everything else.

There are no rules, miners can pick the transactions they want to include in the block.

Unconfirmed transactions sit in the miners "mempool". And when size of the "mempool" becomes too high, miners may decide to clear out some old transactions.

But there are no hard and fast rules, so you should think twice before sending transactions to the node.


Looking for a better way of listing all my peers I am looking for a cheap and efficient way (rather than hacking through the Bitcoin source code) of listing my peers.

Something I have come up with:

#!/bin/bash

netstat -p tcp -nba | grep  '.8333.*ESTABLISHED' | perl -npe 's/.*\s+((\d+.){3}\d+)\.\d+\s+ESTABLISHED.*/$1/'

The script above generates a list of IPs.

Use the getpeerinfo RPC command (available since v0.7.0).


Is it possible to alter the source code and still have a valid Bitcoin transaction? Say I wanted to run an alternative version of Bitcoin, and I changed 1 line in the bitcoin source code.

Is the signature/hash of the completed transaction going be the same or different when I run the original bitcoin software and my altered version? Or would they be two separate transactions?

How do miners know what transactions are valid if there are two different implementations of the BTC protocol?

It depends what you change. If you don't agree with other clients on what is a valid transaction and what is a valid block, then you won't agree on who holds what bitcoins.

  How do miners know what transactions are valid if there are two different implementations of the BTC protocol?

All the people who wish to interoperate with each other have to use the same rules for what constitutes a valid transaction and what constitutes a valid block. Groups that can't agree fork the network into two networks as happened when bitcoin split into bitcoin and bitcoin cash.


Miner transaction selection - how are sigops considered? There is a limit on how much a block can sigop (set to 80000?). There is also a limit on how much a single transaction can sigop (set to 16000?). It thus seems possible (and if it's not possible, the remaining of this question is void, but then how is it prevented?) that an attacker submits five special transactions to consume the whole block sigop limit.

If such attacking transactions are using very generous fees per byte, if the miner chooses which transactions to include in a block based on fee per byte metric, it would include the attacking transactions in a block, getting relatively huge fees per byte, but not filling the block because of sigop limit. This would mean that the miner could get more in fees if it avoided attacking transactions, but the question is whether such selection avoidance is implemented by default.

For the purpose of mining transaction selection Bitcoin Core converts sigops into an effective weight value based on the ratio of the limits. If the weight implied by the sigops count is higher than the true weight, the higher value is used for fee handling calculations. On any kind of remotely sane transaction this has essentially no effect, but eliminates your suggested attack.
See the -bytespersigop setting. The default value of 20 is somewhat less than the ratio of the limits, because the true value distorts costing for non-attack transactions a bit too much, and the smaller value is sufficient to make this kind of attack uninteresting.
It does mean that in the presence of attack transactions paying moderately high fees a miner might earn slightly less income than one that was more savvy about solving this multidimensional optimization problem. However, since the attack doesn't work, the transactions don't get made, making this slightly sub-optimal behavior irrelevant.
The tapscript proposal specifically doesn't use sigops at all to avoid these sorts of issues.


Scanning QR Code to Get Private Key How do I get to scan QR code to get private key of a "watch only" blockchain wallet address?

It is not possible to get the private key from a Bitcoin address. This is the whole point of the cryptographic technology that Bitcoin uses.

The way that this cryptography works is through the ECDSA algorithm which uses a private key --basically a random positive integer that can't be 0 and has to be less than "N" which is an astronomical big number (close to the number of atoms in the whole universe)-- to later multiply it by a point on a cryptographic curve in a finite field (secp256k1). This process is only one way and you can always calculate the result of the multiplication, but you cannot get this result and figure out the private key through division due to the mathematical properties of finite fields.

The result of the multiplication of the private key with the point on the cryptographic curve is another point on the curve which is called the Public Key. This public key is later hashed and encoded in base58 to get the address. The hash is to add an extra layer of security, while the base58 encoding is used to make the public key human readable --this was a thing a decade ago.


I sent BCC from exodus to a BTC address I just made a huge mistake,i sent my claimed BCC from my Exodus wallet to my  BTC.com wallet .oops .Can i get them back ? The transaction has been passed OK on the block chain.

There is no way to reverse a bitcoin transaction. Transactions on the bitcoin network are designed to be permanent and irreversible.

You can use a Bitcoin Cash blockchain explorer to see where the BCC now resides by checking the address you sent from and to.


How is the proof of work actually proved in the mining pool? When mining Bitcoin in a mining pool, we share the coin for percentage of the work we have contributed.  But how is the work "proved".  For example, if the mining software reported "it has done 1G hashes", how is it proved that the 1G hashes are actually done?

When a pool issues work to a miner, it is typically for a lower difficulty than the network difficulty. This allows the miner to solve a block header for the lower difficulty and submit it to the pool. These submitted headers are known as shares.
Even though most shares will not be valid for the network, having miners submit shares allows the pool to track how the individual miners are performing. Pools will pay their miners proportionally to the number of shares submitted, with some caveats (usually it isn't exactly proportional, there are various caps and other things calculations done, but in the end, the proportion of shares submitted is the major factor in the payout calculation).


How are newly created bitcoins are validated? I'm trying to understand how Bitcoin works but there's a concept I can't get my head around.

I understand that transactions are validated by checking the signatures of each input is valid. However how do you validate new bitcoins or rewards that have entered the system through mining if these don't contain any any inputs?

For example if you're checking a transactions inputs are valid eventually you'll reach the point when the inputs were originally mined, so how would you know these were created legitimately?

The first transaction of each block is special according to the Bitcoin Protocol, and people give it a special name: generation transaction (because it can generate new bitcoins) or coinbase transaction (because it's the only transaction to contain a field called the "coinbase" [the company Coinbase is named after this field, but is otherwise unrelated]).

Generation transations have the following rules (among others not relevant to your question):

One, and exactly one, generation transaction must be present in every block.  (If you've ever heard of "empty blocks", that just means a block with nothing besides the generation transaction.)
They can only have one input.
That input "spends" an output (outpoint) of all zeroes.  This doesn't correspond to any actual transaction output.
That all-zero outpoint is considered to contain the newly-generated bitcoins (subsidy) for this block as well as the transaction fees paid in this block (fees), which are collectively known as the block reward.
The special input has a field called the coinbase field where the signature script (scriptSig) would go in a regular transaction.  Anything put in this field is validated like in a normal transaction, but in the original Bitcoin protocol, miners were not required to put anything in this field at all---they didn't need to provide a signature since the only person who could've created this transaction as the first in the block was the miner themselves.  Since them, BIP34 and BIP141 have changed the rules somewhat, but not in a way relevant to your question.  Also not particularly relevant, the coinbase field is limited to 100 bytes in length.

Actual validation works like this:

When a node receives a new block, it starts by looking at all of the transactions besides the generation transaction.  It calculates how much transaction fee they all pay.
Then the node calculates the amount of new bitcoins (subsidy) the miner is eligible to claim, for example 50 BTC for the first 210,000 blocks or 12.5 BTC as of this writing (blocks 420,000-629,999).
The node adds these two numbers together.  This is the maximum amount of block reward the miner can claim.
Now the node looks at the generation transaction, makes sure it follows all of the other rules, and validates that its outputs spend a total of less than or equal to the block reward computed above.

Of interesting historical note, the generation transactions in over 1,000 blocks did not claim all the block reward they were eligible to claim.  This seems to have mostly occurred early on.  What happened to those bitcoins?  They can't be claimed by the miners of those blocks after the fact and nobody else can claim them, so they're permanently lost.


Is it possible to execute a double-spending attack in Ripple during a network split? From the spec (emphasis added):

  Under a net split, a ledger may be closed by the minority of network, this ledger may be discarded in the future.

Does this mean it would be possible to spend twice, once on each side of the split?

Even if the transaction is merely rejected later, you could trick a merchant into accepting your payment, then take delivery, and then let the network reject the transaction once the split is resolved. Is this correct? How would the minority of the nodes know that they're separated from the rest of the network?

Ripple should be immune to this attack because a transaction is not considered validated until an overwhelming majority of validators (that you care about) have signed a receipt saying that they have processed it (by validating a ledger that includes it either in that ledger or in one of its prior ledgers). If the network had split, you could not receive receipts from an overwhelming majority of validators.

Ripple servers have an internal "gate". They continue to track the network, try to reach a consensus, sign validations, and so on. But they don't report transactions as confirmed to clients until they pass this internal gate. To pass the gate, a ledger must have sufficient validations from trusted sources. Once a ledger meets that threshold, the gate is advanced to just past that ledger and everything up to that new point is considered fully validated.

Anything after the gate is in flux, subject to consensus with other validators. Everything behind the gate is forever committed. The overwhelming majority of validators have committed to it.

If you are on the minority side of a split (or even the slight majority side of a bad split), no transactions will pass the gate. The network will be unusable, but nobody will rely on a transaction that gets undone when a split is resolved.

In exchange for immunity to this attack and in exchange for Ripple's fast confirmations with no proof of work needed, a price is paid. One can imagine situations where transactions might fail to pass the gate even though there's no network split. For example, if a large number of validators suddenly stop validating all at the same time, you might think you're split off from them, and manual intervention might be needed to permit any transactions to pass the gate.


Is it possible to restrict where coins from a given P2SH address can be sent to? I would like to create a checking/saving style scheme where coins from savings can only go into checking before they go anywhere else.

Is this even possible in Bitcoin?

No, Bitcoin script has no view of the output of a transaction as a design decision. This sort of behavior is called a covenant, which is usually regarded to be a fairly poor idea.


Which wallets belong to Satoshi Nakamoto? I am curious to know which wallets belong to Satoshi Nakamoto? I heard that the BTC in them were never moved.

No real way to tell that Satoshi indeed owns wallets (unless he sends a signed message).
You can assume which blocks he mined and therefore his wallets like so.
http://bitslog.wordpress.com/2013/04/17/the-well-deserved-fortune-of-satoshi-nakamoto/


Incentive and 51% attack White paper:

"The incentive may help encourage nodes to stay honest. If a greedy attacker is able to assemble more CPU power than all the honest nodes, he would have to choose between using it to defraud people by stealing back his payments, or using it to generate new coins. He ought to find it more profitable to play by the rules, such rules that favour him with more new coins than everyone else combined, than to undermine the system and the validity of his own wealth."

Still, I've read bitcoin community is concerned with 51% attack:

http://blogs.wsj.com/moneybeat/2014/06/16/bitbeat-a-51-attack-what-is-it-and-could-it-happen/

Actual bitcoin implementation does or does not have incentive system as per whitepaper to discourage 51% attack?

Bitcoin has a huge incentive system to discourage a 51% attack. Bitcoin mining with CPUs is impractical. You have to use dedicated hardware that can only be used to mine Bitcoin and other coins that use the exact same algorithm.

So to acquire enough hashing power to launch a 51% attack on Bitcoin, you can't just rent computing power or buy CPUs. You have to invest in Bitcoin mining equipment. If you manage to harm Bitcoin significantly, you're just turning your expensive mining hardware into so many doorstops.


as a individual miner's side, how UASF, UAHF agree or disagree is occurred? UASF is timestamp-based method. after that time, new rules will start. but i have a few question about this. how this rules is accepted by USER?

does miner program contains 'yes' or 'no' about this decision?
'1' is true, and user not express any decision. by this case, is user's fork can be violate fork?
Who is the representative in the working blockchain that inform 'this feature will be added!'?    How is the notification received by all nodes?

does miner program contains 'yes' or 'no' about this decision?

No. Forks are not votes, especially user activated forks. A user activated fork occurs with no requirements on miners. There is no signaling of readiness from miners nor do miners have any say on when it activates. All miners can do is decide whether they want to mine the fork and enforce its rules after the fork occurs.

  Who is the representative in the working blockchain that inform 'this feature will be added!'? How is the notification received by all nodes?

There is no representative (that would imply there is some central authority in charge of the blockchain and there is not) nor is there any sort of notification system.

A user activated fork happens when a group of users decide they want some consensus change to occur. They write software that implements this change along with the activation time. Those users will then try to get other users to join them. When their fork activates, they will start enforcing their new rules.


What are some possible causes of the BTC-e 'flash' crash? What circumstances made this possible? What entities or major factors could be the cause?

Flash crashes can and will occur in any market where technology (algos) determine trading.  Always tailed by real people panic selling (or panic buying).

Doesn't matter what market you are in.

There also the effect of futures trading (I know of a few futures/options houses that operate in the crypto-space).

There is really nothing you can do.  Worrying about it now (while it is happing is pointless). But to give you an answer (at least for litecoin pricing pressures) newer ASICs miners are 'supposedly' creating too much liquidity.

There are quotes from the old world of stock trading that ring true here (non-cited and paraphrased):

"The market is designed to make as many people look as stupid as possible..."

and

"Do you want to look like a fool before the crash or after the crash..."

Seems to apply pretty well to the new and shiny crypto-currency markets too.

But there is another quote that is pretty famous and great to light up those of us enveloped in the darkness of nasty market moves.

"Be fearful when others are greedy and greedy when others are fearful..."

Here is the thing, when everything is mined to the point that it is simply not feasible to continue and coins are lost over time then you will find yourself in a deflationary situation where all of a sudden your coins (bitcoins and litecoins) are hit with supply-side pricing movements to the up-side that will pale in comparison to anything you have seen before.

Since we are about half-way there, I would recommend relaxing and watching the fireworks because the low-hanging fruit is being consumed.

Finally, I would venture a guess that we will see this supply-side anomaly begin to take shape in early 2017.


Algorithm to recover missing 12th word (of 12) in BIP39 mnemonic I'm trying to recover my Wasabi wallet. For some reason the 12th word of the 12-word mnemonic I wrote was wrong (not in BIP39 list). I could manually guess up to 2048 times, but was hoping there might be an algorithmic way to work through an array of the 2048 words and associate the result with my public keys for the wallet to find the right word.

I'm a newbie programmer, so any guidance on an approach to solve would greatly help and help me avoid a long manual slog. Thanks.

You will have to check up to 128 variants. Try this software: https://kzen-networks.github.io/mnemonic-recovery/src/index.html


Is there A Mechanism In Place that Prevent Address 'Squatting'? Is there a function or mechanism in the bitcoin protocol that prevents someone from creating millions or billions of bitcoin addresses and just sitting on them? Do the addresses need a minimum balance of outputs? or Does that distributed DB save each address? (And if it is saved....what is saved?  The base58 address or the full Public Key? I am also familiar with the ecdsa algorithm.)

The network doesn't require proven ownership to make an address valid, otherwise one would never be able to send bitcoins to a new address. Any address in the address space can receive a transaction at any time. Also see here:
At what point is a new wallet known by the Bitcoin network?

Creating a great number of addresses is possible, but impractical, because the address space is simply too big for anyone to even store a significant portion of the addresses. See a more thorough explanation here:
Is it possible to brute force bitcoin address creation in order to steal money?

Assuming the "That distributed DB" refers to the Blockchain, the Blockchain stores every transaction ever made on the Bitcoin network. See What is the “blockchain”? and Where are the user's bitcoins actually stored?.


I have a problem syncing my wallet i'm still running the qt 0.63, wich has a problem syncing to the network. It gains about 1% a day.. bitcoins that have been sent my way cannot yet be seen in my account. is it safe to make a back-up now and uninstall the qt client, and then reinstalling a newer version or a different wallet? Can i just copy-paste my wallet.dat after that?
thanks

You should be able to just upgrade your bitcoin-qt.  Your wallet.dat file can just stay in place.  Back it up just to be safe but you shouldn't have any need to use the backup just because you are upgrading.


Colobit LTD looks like Bitpetite! Anyone have any experience with them? I signed up with Colobit.biz roughly a month ago. I have a coin base and BitConnect account along with a few others. Colobit was new and thought I'd be the first to sign up and get out before everyone else jumped in.

They are not allowing me to withdraw bitcoin!! Their customer service said it takes 7 days after I request. Funny how when you make a deposit its instant? It is starting to look like a typical ponzie. The site isn't written by someone fluent in English. Also, the 'stats' on the bottom keep increasing in every category except for total withdraws of Bitcoin.

1 week ago they boasted 500 BTC deposited and 51 BTC withdrawn. Now it's 2100 bitcoin deposited and 53 Btc withdrawn!! The money is flooding in. Is ColoBit a Ponzie scheme??

Is ColoBit a Ponzie scheme?

It's a scam of some sort, probably akin to a Ponzi scheme.

  thought I'd be the first to sign up and get out before everyone else jumped in.

Perhaps you knew what you were getting into.


P2SH-P2WPKH private key or revert to P2WPKH Is there a way to get the private key out of an P2SH-P2WPKH address, using Bitcoin Core 0.15.1?
If not, is there a way to get the origin P2WPKH address to get the private key out of this address?

In 0.15.1 you'll need to find the P2PKH address corresponding to the key (it's the argument to addwitnessaddress you used for creating the address in the first place), and pass that to dumpprivkey.

In 0.16, things will likely just work.


Does listsinceblock list all transactions, or only transactions my wallet is interested in? Wondering if I call listsinceblock "", will I get all transactions that ever occurred on the blockchain regardless of whether my wallet was party to it, or will it only be a list of transactions relevant to my wallet (things I've sent/received/have a private key for at least one side of) ?

listsinceblock will only list txs your wallet is interested in i.e. transactions involving as input or as output an address A such that:

either A is an address whose private key is known to your wallet and consequently can sign transactions that spend UTXOs of A
or A is an address your wallet is following as watch-only i.e. does not know A's private key but A was added to the wallet using importaddress

listtransactions will also only return transactions your wallet is interested in but with different criteria. It returns count most recent txs of interest (as per above criteria) and you can also define to omit most recent skip txs and also filter by label (or account for older versions which is not deprecated).

All in all, following two should both return all txs your wallet is interested in:

bitcoin-cli listsinceblock <hash_of_genesis_block> 1 true

bitcoin-cli listtransactions "*" <a_number_greater_than_your_wallet_total_tx_count> 0 true

There is no direct way through CLI to return all txs in the blockchain afaik.


How to move Bitcoins from desktop wallet to mobile wallet? I have Bitcoins on my desktop wallet client.

And i now have the Bitcoin Wallet by Andreas Schildbach installed on my Android device.

IS it possible to move the desktop wallet to Android wallet?

If you want to move Bitcoins in the sense of a wallet command it would require some more technical integration.

However, the easiest thing is to scan the QR-code of your Android mobile wallet with your webcam. I use QuickMark for the scanning. Then you can simply copy paste the Bitcoin address to your desktop wallet and send Bitcoins to your phone via the network.


Coins sent while wallet closed I opened my wallet after almost a year and all of a sudden I see 2 transactions saying I sent coins to someone.  The address it says I sent to is 1PAZw2aNgurapsxUVm8ctZDD76v7JiwQkC however I never sent this.  So, if someone is stealing my coins how do they do it while my wallet is closed (and incidentally it is also encrypted)?

I have done several deep scans...my guess is that I had tried out a mining pool and that software was the culplrit...needless to say I deleted it and did multiple deep scans.  But if my keys are compromised is there any way to change them?

Nate thanks for the reply...is there a way to change my private keys are get new ones?

If someone gets access to your private keys, they can create a transaction that spends your coins.  This transaction can be created and sent from any computer in the world.  There's no need for your computer to be involved, and it's irrelevant whether your wallet software is open or not.

It's possible that some person or malicious software had access to your computer at some  point during the last year (or before) and copied the file which contains your private keys.  If it was encrypted, they would need to decrypt it, but if your passphrase is simple enough, that may not be very difficult.  Their software may also have been running earlier and recorded your passphrase at some point when you typed it, or extracted the private keys from the computer's memory while the wallet software was running.  For whatever reason, they may have waited some time before spending them.

If there were other copies of your private keys somewhere else (such as in a backup, or on an old computer or phone that you gave away or had stolen), then that is another place they could have got them.  In that case your computer needn't have ever been involved.

But you should probably assume at this point that your computer is compromised.  The safest course of action is to back up all your data files (but not the operating system or application programs), wipe the system and reinstall it.


I'd like to connect an LKETC USB Scypt Miner to my Raspberry Pi. Help? I am new to bitcoin mining, but pretty good with technology as a whole.  As a Father/Son project, I recently purchased a couple of USB LiteCoin Scrypt miners (I bought them here: http://www.aliexpress.com/item/free-shipping-hot-selling-litecoin-USB-miner-220kH-s-scrypt-miner-Litcoin-miner-send-out-in/2019121334.html ).  These have some drivers on them - they came with the Miner and are Windows based (or so they seem) - but I am strictly a Mac / Pi user.

So, I need some help in determining how to connect these Miners to a Pi or a Mac.

Can someone help me?
Many thanks in advance.....

I think these might be rebranded ZeusMiner ASICs - LKETC doesn't appear to sell any scrypt miners below the 1MH/s range. Also, some of the reviews on that item say that they've had luck on linux with a fork of cgminer with ZeusMiner support.

There are two drivers you need. You need a driver for the USB-to-UART bridge, and a driver for the ASIC. The former is distributed with Raspbian, assuming the bridge is a Silicon Labs CP210x. (I think it is, based on the screenshots on that page.) The latter is usually distributed with your mining program of choice.

Possible fix

All instructions are intended for Debian/Ubuntu/Raspbian.

$ sudo apt-get install build-essential libtool autotools-dev autoconf git
$ git clone https://github.com/dmaxl/cgminer/ && cd cgminer
$ ./autogen.sh
$ ./configure --enable-scrypt --enable-zeus
$ make
$ ./cgminer

Troubleshooting (if that doesn't work)

When you plug it in, it should create the device /dev/ttyUSB1, and a device under /media or /mnt. You're interested in the first one.

You can get a list of devices that are plugged in with lsusb.


Is it possible to have multiple wallets which send money and/or multiple wallets which receive money in a SINGLE transaction? Or every transaction consists of only one sending wallet and one receiving wallet.

A transaction is composed of inputs and outputs.
The inputs are the funds that go into the transaction, they can be from multiple wallets as long as every input (an input is an output from some previous transaction) is signed for by its owner.
On the output side we can send funds to any number of addresses (we are limited only by transaction size in KB)
So yes, it is possible to do just that.
As a practical example look at CoinJoin which is a way to combine inputs from different wallets together.
Hope this helps.


How to get the Input Address from vin where only a txid is given (Insight-Api) I like to find the Input Address and Amount for a vin like this:

"vin": [
    {
        "txid": "e3f0e88ce224d342a0189c1b9d2fd488d8bda2f303dbe1e1dbbaa5f51d9f4a53",
        "vout": 1,
        "scriptSig": {
            "asm": "3044022036c454ee41d67ee7c00fade55d57b573794916c1e1d9f301a038547daa5fcc0502202c99917b5590adf2ede1b8e3a6773369690a268c7b445664223ec8f92288e81e010272491cc9c405bfdc35f766bd849ddc58268088c202425cec224aa05cbf8547be"
        },
        "sequence": 4294967295,
        "n": 0,
        "unconfirmedInput": 1
    }
]

This is from txid: f4f2ddb44a8d155bc795e3e7497714fd6a1f035a6438b22403a7faa67012b9ec

Thanks

First, use the API to get the information on the txid.

/api/tx/e3f0e88ce224d342a0189c1b9d2fd488d8bda2f303dbe1e1dbbaa5f51d9f4a53

This result will include all of the details you're looking for. Here are the parts that you're asking about. The n here corresponds to the vout number above, I believe, and the value and addresses values are the input amount and address.

"value": "2405.38864196",
"n": 1,
"scriptPubKey": {
    ...
    "addresses": [
        "1NG1nT2ZuFw47f41mGjYpPp7J837yTQZhB"
    ]
},
...


Can a 'free' Bitcoin 'marketing' ad be checked in any way Total Bitcoin newbie here. I have no bitc, nor a wallet, nor am I sure I want one. I've been intrigued for a while, but security is a big passion of mine...

Today just now youtube pointed me to an interesting lecture by Bill Gates and others. [1] Apparently it was at the SF, CA exploratorium in the 'morning', but that would not fit with the current timezone if it is live. (That part just came up at the end of the Bill Gates section a few minutes ago.)

This video is supposedly by Microsoft Europe - but the author has only this video.

There was a big picture on the screen while Mr. Gates was speaking at the "Village Global" event. It advertised free bitcoin if you send in bitcoin, eg they will send you back 10x what you send in from 0.1 to 20 Bitcoins.

The address per "Microsoft admin" in chat is: 1w1AQvpK4ixo9YQ3KHFYi4BgKHuDqg1hR

Online I looked that up [2] and found this:

Total Sent
0.00000000 BTC

I believe that indicates the ad is definitely a scam.
Did I get it right???

Are there other ways to check for scammers that I may not know?
Thank you so much!

[1] Bill Gates about Microsoft Future, Quantum Power, Bitcoin Evolution - YouTube: https://www.youtube.com/watch?v=oKzuP-Pljpw

[2] Blockchain Explorer - Search the Blockchain | BTC | ETH | BCH: https://www.blockchain.com/btc/address/1w1AQvpK4ixo9YQ3KHFYi4BgKHuDqg1hR

Yes, this is very obviously a scam.

For some reason, some people seem to lose common sense when Bitcoin (or cryptocurrency in general) is involved. So here is a really quick way to check if an offer sounds legit: Consider the same situation, but using $USD (or your local currency of choice).

For example:

It advertised free dollars if you send in dollars, eg they will send you back 10x what you send in from $500 to $100,000!

Does this sound believable? What about:

It advertised free bitcoin if you send in bitcoin, eg they will send you back 10x what you send in from 0.1 to 20 Bitcoins.

(At the time of writing, 1 BTC is worth approximately $5K USD).

Ask yourself: what business would do well to give away $100K USD worth of anything to random people on the internet?

If it sounds too good to be true it probably is.


How to use command line flags in Linux? I'm using bitcoin-qt(0.8.0) on ubuntu studio (12.04.2), and suffered a power failure while loading. Now I receive the "failed to load block" error message.

This happened to someone else, and the answer he was given which solved his problem was to run it from the command line and use the -reindex flag.
I'm hopeful this might work for me as well, but I don't know how to go about it.

I know how to access "terminal", but I don't really mess with it. I'm at a loss.
Any help would be greatly appreciated!

Try this:

Close Bitcoin.
Press Alt + F2
Type bitcoin-qt -reindex
Press enter.


Why are median transaction fees so much higher now (in october 2017) than a year ago? Now that segwit transactions are consistently making up 10% of each block and the witness section is making up more than 6% of the block, I'm a little confused by why median transaction fees are still high. A year ago, there were about 230k transactions/day and now there are about 260k transactions/day - just a 13% increase. But fees are up 1400% since a year ago.

What's causing fees to remain high even tho we've increased capacity by 6% (and rising) and only have 13% more transactions? Are people still falling for bad fee prediction algorithms? Is there an increased demand for quickly-confirming transactions?

The relation between average transaction size and average transaction fee is not linear.

  Are people still falling for bad fee prediction algorithms?

There are no good prediction algorithms here. Think about 110 people waiting for  a bus, but the bus has only 100 seats.

  Is there an increased demand for quickly-confirming transactions?

I don't think so. Most of users do not care at all about transaction fees while their capital grows.


Why is CPFP (Child pay for parent) immune to double spend? Assuming I have 10 Bitcoins in my wallet and I send 4 BTC with a tiny fee and it gets stuck in the mempool due to a low transaction fee. If I understand CPFP correctly I would then send a second transaction of 4 BTC with a higher fee to the same address. My second transaction is likely to confirm quickly, but what happens if most of the mempool transactions start to get processed due to low demand and my first transaction finally gets processed? Why would a miner reject it and would I be left with 2 Bitcoins or 6?

If you're doing CPFP right, The two transactions you sent are both originating from the same UTXO, but one spends the output of the older transaction with a higher fee.

If the miners want to get the fees of the last transaction ( the transaction with the higher fees), they will need to mine the first one aswell.

So, if your first transaction gets processed first, it's probably just a matter of time before your second one gets confirmed (due to the high fees), leaving you with the 4 bitcoin - (fees).


Does blockchain.info show balances for addresses that are in cold storage? If a miner mined a large amount of coins and these coins were stored offline once generated, would the balance of the addresses that hold these coins still be viewable on a blockexplorer like blockchain.info if you had the public address?

Or would a person need to use something like bitcoin core or bitcoind and add the address as a watch only address and call getbalance?

I'm trying to verify if a seller actually has the coins they claim to have. They apparently can show the wallets and their balances to the person interacting with them in the office now using bitcoin core. But is there any way for me in another country to confirm that what my colleague views is actually accurate and correct?

Does blockchain.info show balances for addresses that are in cold storage?

Yes.

  ... is there any way for me in another country to confirm that what my colleague views is actually accurate and correct?

Since they use Bitcoin Core, yes, there is a way to verify that they hold the addresses that they claim. Have them sign a message with each address that they claim to have the holdings on, using Bitcoin Core you can verify that they indeed have those addresses and check them on blockchain.info to find the current balance. This feature has been in Bitcoin Core for a long time.

Only works in Bitcoin Core currently for addresses starting with a '1' (not Segwit addresses starting with a '3' and not Bech32 addresses starting with 'bc1' - the developers are aware of this and I will remind them shortly.)

In Bitcoin Core, your transaction opposite goes to File -> Sign Message and signs any message with one of the holding addresses. Copy the message, address and signature and send to you via probably plain text format email is the easiest. Repeat for each additional address holding the balance of BTC that they are offering to sell.

In Bitcoin Core, you go to File -> Verify Message and key the details provided EXACTLY - spaces, new lines and all characters must be an EXACT match. Click on verify and voilà.

I prefer the form of signed message as follows (don't key the top and bottom bar rows for the message, just the contents and you can check this yourself, the bottom row is the signature). I like to key the address used for verifying as a part of the message but that is not strictly necessary:

------------------------------
Something that I want to sign.

bitcoin:1PMUf9aaQ41M4bgVbCAPVwAeuKvj8CwxJg
------------------------------
Signture:
IGaXlQNRHHM6ferJ+Ocr3cN9dRJhIWxo+n9PGwgg1uPdOLVYIeCuaccEzDygVgYPJMXqmQeSaLaZVoG6FMHPJkg=

This contains all of the compact information necessary to verify the message.

Example of verified message:


Is there any punishment for Having more than 50% of the mining power of the network I am just curious about it.

In history once it happened That GHASH.io owns 52% mining power, he was malicious and sell 5% to other miner. Bitcoin community keep watch on everything?

Quite the contrary. If a pool becomes too big it just earns more money. There is no punishment. Maybe some bad reputation, but not something the majority will even notice.

It has happened three times so far that pools reached hashpower majority or got too close to it: Deepbit, BTC Guild and GHash.

Only Eleuthria, operator of BTC Guild, handled this in a responsible way. He raised the pool fees which caused some miners to react, moving to other pools. This balanced out the pools.

GHash scammed a casino, but they could have done this without having so much hashpower as we are talking about zero-confirmation transactions. They later said it was done by a rogue employee who is no longer with them.

Deepbit and GHash acted irresponsible and so did the miners. It appears that the vast majority of miners are not keeping watch on whether a pool gets too much hashpower or they just don't care.

The fourth time this happens, maybe some very bad things will happen. Hopefully in that case miners will take note and act more responsibly. It is doubtful though, as almost noone reacted to the casino scam mentioned above.

Disappointing for sure, but it is what it is.


What is the cheapest Cash-to-Bitcoin Service? There seems to be a few services to purchase bitcoins from out there, as in bitinstant, MtGox, bitcoin.de, etc.

I would like to know if someone has looked around to find the one with the cheapest transaction fees for buying/selling bitcoins.

In the U.S., the least expensive method is a Dwolla transfer to an exchange that accepts Dwolla (Mt. Gox, and Camp BX).  Dwolla charges $0.25 per transaction when the amount transferred is over $10.

Quite simply, depositing cash at a bank or 7-11, Walmart, CVS is going to be the fastest and easiest way.

One method that was the least expensive, depositing cash at an exchange's bank, is currently unavailable as the exchange that offered that (BitFloor) has suspended that method, temporarily apparently.

BitMe offers this but they don't have much liquidity yet (on the sell side) so that might not work.

If you are looking to deposit $500 or more, then Bitcoins Direct will accept that cash:

http://bitcointalk.org/index.php?topic=87094.0 (Deposit cash at Bank of America, Wells Fargo or PNC, minimum $500)

All other cash deposit options:

http://www.BitInstant.com (Deposit at major banks, 7-11, Walmart, CVS, Moneygram, etc.,)
http://www.BitMe.com (Deposit cash at Chase)
http://www.BitFloor.com (Deposit cash at Chase or Wells Fargo)
http://www.bitinnovate.com (Deposit cash at a bank in Australia & New Zealand)
http://www.CAVirtEx.com (Deposit cash at several banks)
http://www.Spendbitcoins.com (Deposit cash at a bank in Australia)
http://BitcoinNordic.com (Purchase CashU or UKash in dozens of countries)
http://www.BTC-E.com (Deposit cash (USD) at bank locations in Russia)
http://www.BitNZ.om (Deposit cash (NZD) at back locations in New Zealand)
http://www.BitInstant.com (In Brazil using Boleto or Banco Recomendito, or in Russia, using Qiwi or Cyberplat.)
http://www.bitXoin.com (Deposit cash over the teller at Major Australian Bank Branches)

Alternatives:

If you are in the U.S., there is one vendor that apparently is offering to sell via credit card.

https://www.quickbitcoins.net

The fees aren't trivial but you can use a credit card to purchase by using VirWoX where you can buy SLL using your credit card, then trade SLL for BTC:

http://www.VirWoX.com

There possibly are other options that will work for you as well:

http://en.bitcoin.it/wiki/Buying_bitcoins

Last of all there is #bitcoin-otc where you can connect with sellers via IRC:

http://bitcoin-otc.com/


When do I have to backup wallet.dat? Is it obligatory to backup wallet.dat after each outgoing transfer?

I understand it is, but not after each incoming transfer.

Every 100 transactions, counting both sending and receiving. For receiving, you can treat multiple transactions to the same address as a single transaction.

This ensures that you don't lose any bitcoins if, for example, your hard drive crashes.

The option keypool in Bitcoin-Qt client adjusts this.


Are there any fundamental security vulnerabilities in Bitcoin? Although Bitcoin does its best to prevent double-spending, could it still happen in practice?  Is it just very unlikely that fraud could happen, or is there a mathematical proof that it could never happen?

As David Schwartz said in 367; Dan Kaminsky has spent some time auditing the Bitcoin core . He is a respected security professional, and his opinion on these matters is highly regarded.

He came to the conclusion that there weren't any concerning security vulnerabilities, but scalability is something that will have to be tackled as the project grows. Essentially; nothing the developers didn't already know about.


do you think bitcoin futures exchanges (CBOE/CME) are a positive or negative for bitcoin price and why? do you think bitcoin futures exchanges (CBOE/CME) are a positive or negative for bitcoin price and why?

I do not consider the Futures Exchanges to be a good thing.

I don't trust large institutional traders.  They can and will manipulate prices in their favor.  I believe they are currently running up the price artificially ahead of the start of Futures trading.

Once futures trading begins, they'll short BTC then dump it.  The price will plummet, and their shorts will make a fortune.  Then they'll trumpet how they were right all along about it being a bubble; a bubble of their own creation, burst to benefit them.


Got 64: non-mandatory-script-verify-flag (Signature must be zero for failed CHECK(MULTI)SIG operation) when submitting segwit transaction I got the above error when submitting this transaction:

010000000001013894a4bdcfa20ef5a6cbfe1d22c5fe5041eab586a5ea2b044f969a02dab6b3d200000000171600141a982a7d2712fc33d47c990cd8cde15c87ca2e07ffffffff015e3f01000000000017a914fb2dc3b4dd0731c8f2559506c7d0cb876b0e71298702483045022100c68dac735a3529d84fdbfc3a8a11d313d59a9791b046fc39bbfc55db71d6d2010220028f2bbfba78c393858e3cb7ad51e24e8dfd2260d4a3cbbf8feb4d4c6005967701210371b63ebaa78a70420bc36159bed610b8f788e9a7b953558f06bb40622d9cbfe400000000

A previous transaction from the same P2SH-P2WPKH address was successfully spent but I got this error whenever I try to spend this transaction:

d2b3b6da029a964f042beaa586b5ea4150fec5221dfecba6f50ea2cfbda49438

I already attempted to sign the transaction again a few time but still got the same error.

You will receive this error if the value you are signing is not the exact amount of the entire unspent output value.

For example, if your unspent output value is 35,000, and you only want to send 30,000, your output value would be 30,000, and your signing amount would be 35,000. If you sign for only 30,000 (not the full amount of the unspent output) you will receive this error.

Visual Example Using BitcoinJS:

//add input
txb.addInput(txid, outn, null, scriptPubkey);

//add output
txb.addOutput(receivingAddress, 30000); //amount less the mining fee

//signing
txb.sign(0, keypair, null, null, 35000); //NOTE the amount is the FULL amount of the unspent output, NOT the amount being sent


How will mining work after 2140? The nonce header of a block has 32 bits. The vast majority of the time, none of the 2^32 nonces will result in a block hash below the target. So to continue mining, miners usually change the extraNonce in the coinbase transaction. But what will happen once all the bitcoins have been mined and there is no coinbase transaction anymore? I know this will only happen in 2140, but have we thought of a way to change the nonce range when it will be the case?
Thank you for your help.

There’s no such thing as a block without a coinbase transaction. Even if the block reward plus fees is zero, it is still a mandatory transaction at the start of every block, it just pays nothing.


Why some blocks didn't use full potential of their size? Currently there is 73600 Unconfirmed Transactions. But some blocks has only 749 kB or 0,21 kB or two block in row has 33 and 173 kB.

Why this blocks does not have 99x.xx kB? I mean there is a space for other transaction, why it is not include to this blocks?

Blocks:

440216 - 33 kB

440217 - 173 kB

Probably because a winning nonce/hash was found before they were able to fill up with transactions. There's no incentive in Bitcoin to make blocks fill up with transactions. In fact, there are blocks with no transactions (besides the coinbase one)!


Will upgrading to a new version of Bitcoin Core leave my wallet intact? If I download Bitcoin Core 0.14.1 to my Windows 8 drive will it simply overwrite my existing Bitcoin Core version v0.11.2 (64-bit), leaving all my BTC in my wallet intact?

In the case that you mean "install" instead of download: Yes, it should not interfere with the wallet.dat at all, and the new version of Bitcoin Core will continue to work with it.

Regardless of your updating the software, you should have at least one backup of your wallet.dat. If you don't, create some now. Preferably before the software update. Be sure that Bitcoin Core is not running when you copy the wallet.dat.
Be sure to close Bitcoin Core before installing the new version.


Why transaction is signed with locking script from the input transaction? Finally, I've successfully made a raw transaction with Python and this is the last thing, which is totally mistic for me.

In my case, here's the input transaction and it's locking script is:

OP_DUP OP_HASH160 dab3cccc50d7ff2d1d2926ec85ca186e61aef105 OP_EQUALVERIFY OP_CHECKSIG

Why it's necessary to set up the unlocking script to the input's locking script before signing? In my understanding, all the stuff should work well even with blank locking script, because in fact we're signing only other parameters. Unlocking script and unlocking script lenght will be changed anyway, so what's the reason?

There is no definitive answer here, and you'd need to ask the system's creator to be sure.

My guess is that it was due to interaction with a feature that we're now calling 'delegation': the ability for someone to presign a transaction, and add a new unlocking script- effectively delegating the right to sign to someone else under certain circumstances.

Elements of the script language that point in this direction include the existence of OP_CODESEPARATOR, and the original execution model of running scriptSig + scriptPubKey in one go, rather than separately as is done now.


So every private key actually has TWO associated addresses? (ie uncompressed and compressed) So every private key actually has TWO associated addresses? (ie uncompressed and compressed)

Isn't this a MAJOR flaw if uncompressed keys are still used in applications?

Nope. It's not. If you really think it's a flaw, explain some way you think it can do harm.


How do I find the wallet that Bitcoin was sent to? How do I find the wallet that Bitcoin was sent to?  I was new to Bitcoin and created at wallets in at least 2 places (Armory and Coinbase) but all are showing zero.

If you know the public address that it came from, you can check the block explorer for the most recent transaction.


How to move blockchain.info api created wallet to be used by bitcoin core I originally created my wallet through the blockchain.info api.  I have since downloaded the bitcoin core and it's finishing downloading all the blocks now.  What is the process to access this wallet directly?  Also, is this a one way transfer, or will it still be usable through the blockchain.info api?

Thanks.

You would need to extract the private key from blockchain.info, and get it imported into bitcoin core. See here:

I don't know how to export a private key from blockchain.info

You may need to repeat this step, if you have several wallets in blockchain.info.
Once done, it is like having two wallets, with the same privkey. Nothing prevents you from using both.


Why bigger blocks will bring bigger memory usage for miners? I see the different proposals for the block size and I keep wondering why bigger blocks means a bigger chain ? If the block limit size will rise to twenty-megabyte, it is just a limit, to fill it it requires twenty-megabyte of transactions. so if there are twenty-megabyte of free transactions a block will be twenty-megabyte size but it all still depends on the total size of valid free transactions and now it doesn't even get to 600k in average. yes in time the block will be filled I guess it will take years but it is the natural growth of the system. so my question is why bigger block size means immediately bigger memory for miners ?

Mike Hearn pointed out earlier on the mailing list, Satoshi added a block limit to avoid people mining "troll blocks". These are blocks where a miner includes a Gb worth of transaction output/scripts in the coinbase transaction, or thousands of small transactions. A hard block limit puts a cap on our exposure to this.

There is no minimum block size, since you can still have empty blocks, so increasing the block limit will have no effect on miners.


How do fees get processed in bitcoin? (protocol question) If the fee isn’t written into the ledger, and it’s just the difference between the input transaction amount and the output transaction amount, how does the miner prove he has access in his wallet to the fee amount?

how does the miner prove he has access in his wallet to the fee amount?

Miners do not prove this.
The ability to reap the difference in inputs and outputs in a coinbase transaction is baked into the bitcoin consensus rules.
Any miner who was lucky enough to find a block can sum all the differences in included transaction inputs and outputs in a block and aggregate them in the coinbase transaction.

The miner can then spend the coinbase outputs 100 blocks later.

Edit #1: @eponymous's comments regarding potential reduction in bitcoin supplies if miner does not reap all transaction fees.

Suppose a miner elects to not reap all the difference in inputs and outputs in a coinbase transaction, then the supposedly total supply of bitcoins will be reduced. The 21M bitcoin supply is a theoretical limit that assumes that all miners reap all potential transaction fees and block subsidy rewards.

Example: Total difference in inputs and outputs is 1 BTC, but miner reaps 0.9BTC. Then 0.1BTC will be lost from circulation.

Edit #2: Included @pwuille's excellent explanation on the existence of 21M bitcoins


What is meant by "releasing code tells the hackers what to attack"? I came across this statement from a SolidCoin developer:

Can anyone explain this statement?

  [06:48] gavinandresen: I came here to ask RealSolid to be responsible
  and report problems or vulnerabilities to the core bitcoin dev team
  before releasing code that fixes the exploit (because releasing code
  tells the hackers what to attack).  RealSolid, I'll ask again:  are
  you willing to do that?

The user "Gavin" asked RealSolid to first report vulnerabilities and only then fix them, because "releasing code tells the hackers what to attack". The conversation is archived in this chat transcript.

It would appear that Gavin is advising against providing zero-day attack vectors.

Essentially, if someone gives fairly precise instructions (e.g. a code sample) on how to exploit a vulnerability then anyone monitoring that discussion can exploit it. This is the zero-day exploit because no-one has had time to react, create an appropriate patch and disseminate it widely. Until the patch overtakes the exploit then the affected systems are vulnerable.

Consider the famous "Java Double of Death" (see http://www.exploringbinary.com/java-hangs-when-converting-2-2250738585072012e-308/ for details, Oracle fixed it here http://www.exploringbinary.com/fpupdater-fixes-the-java-2-2250738585072012e-308-bug/).

Imagine if a malicious coder decided to put that magic number into a request against your web API that and exploited the fact that you haven't patched your JVM? You'd be seeing an awful lot of unexplained JDK downtime and lost business.

There is a fair amount of discussion about this topic over on Security StackExchange which references this Wikipedia page about responsible disclosure.


How can I use a large input if the difference of the outputs and the inputs goes to the fee? I'm confused by how exactly Bitcoin transaction are calculated. A transaction contains inputs and outputs, and if its inputs exceed its outputs the difference is deemed as the transaction fee.

So, if I just mined a block and received 25 coins in reward, there were no previous transactions related with my address and I want to make a transfer of 0.001 Btc using my 25 Btc balance. Then, there will be a 25 Btc input and a 0.001 Btc output, and the difference in the amount of 24.999 Btc all goes to miners?! Please help me understand.

You would create a transaction with two outputs, one being 0.001 BTC to the recipient, another being 24.9989 back to another key you own yourself (called a change output), and the difference of 0.0001 BTC would be fee.


How start make a application with php I'm new with bitcoin, and I would like create a application that have wallets and transactions, but I dont know how start, I was reading the api blockchain.info and is interested use the module that they facilitate you. But this modules is with nodejs, and I want make my application with php (laravel).
My question is, Can i use blockchain api with php?, Is mandatory install the module of blockchain?.
I have bitcoin-core installed, but nevertheless I have not used any of the 3 commands such as bitcoind, bitcoin-cli and bitcoint-qt, I would also like to know what it is for?,
if this is combined with blockchain-wallet-service?, or How I can star using bitcoin-core to start with php?.

To get started I'd recommend you familiarize yourself with the JSON-RPC API that is built-in with bitcoin-core (https://en.bitcoin.it/wiki/API_reference_(JSON-RPC)).
Once you have installed bitcoin you need to configure it. You do this by creating a bitcoin.conf file and setting our options inside of it.
Create a new file in your text editor and make sure you have a RPC username/password and activate the daemon by setting it to 1.
rpcuser=someusername
rpcpassword=somepassword
daemon=1

Save your text file as bitcoin.conf in your /bitcoin directory. You may need to do sudo apt-get update first. Bitcoin will be installed in ~/.bitcoin
You should now be able to execute bitcoind and let it sync with the network. Navigate to your bitcoin directory and type in bitcoind in your shell.
bitcoind

Give it a few minutes to start syncing but you can verify the status of your node by typing
bitcoin-cli getblockchaininfo

Now you need to wait for the syncing to finish.
If you check the bitcoin wiki JSON-RPC page you will see references for many different languages. The library recommended for PHP is the EasyBitcoinPHPLibarary. The easiest way to get the library is to visit the GitHub page (https://github.com/aceat64/EasyBitcoin-PHP)
The easybitcoin library makes cURL requests to bitcoind's JSON-RPC 8332 port.
Copy the contents of the easybitcoin.php and save it as a new php file called easybitcoin.php. Make sure you place this file in your web server directory as you will need to require(); it in you PHP code.
Now you can start making calls to your bitcoind server through PHP, for example to get the balance of your node...
<?php
require("easybitcoin.php");
$bitcoin = new Bitcoin("someusername", "somepassword");
$balance = $bitcoin->getbalance();
print_r($balance);
?>

You can also create new addresses, by changing getbalance() in the above example to getnewaddress();. If you want to add a label for this new address just include it in the parenthesis.
$info = $bitcoin->getnewaddress("Nakamoto");

You will see a brand new bitcoin address that has been added to your node and can start accepting transactions.


Is it possible to increase the transaction fee of a sent transaction not yet in a block? Is it possible to increase transaction fee of a transaction that is already  sent and seems stuck?

Today? No.

There was a feature that was developed referred to as child pays for parent however few miners if any are using this patch.

There have been instances where mining pool operators have been offered a bounty to include a specific transactions, but there is no automated process for that and presumably would require a significant incentive.


Can a bad actor omit an unspent address from a pruned chain? This isn't a problem today, because if I want to run a pruned node then I still have to download the whole chain, but it sure would be nice if I could just download a pruned chain instead and validate it.

The attack I'm thinking of would be that I download a pruned chain, but the person I got it from omitted an unspent address from a thousand blocks back. I'd have no way of knowing.

This means that the full chain will always have to be downloaded and pruned manually. Right?

edit: I think I figured it out. All the unspent addresses on a pruned chain should add up to all the bitcoin in circulation, which is known based on how many blocks there are. So you could tell right away if someone evil omitted an unspent address.. Turns out that doesn't help

This is precisely why Bitcoin Core does not support pruning in this manner. However this does not always need to be the case. There are people working on things like UTXO set syncing where each block commits to the UTXO set as of that block. You can then use that to be sure that you have downloaded the proper blockchain.