text:
Why bitcoins not reflected in bitcoin wallet after being transferred from Web based wallet to its address even after ten confirmation?
[]
1I have purchased bitcoins worth  12$ using localbitcoins.com and send it to my wallet address(bitcoin developers).  In blockchain.info it is showing it has ten confirmations yet it is not being reflected in my wallet? I have updated the wallet. Its been six hours.
My wallet and my blockchain.info information  is shown
Please help me.

https://blockchain.info/address/1Q7D2ECCYBxJY6z29RG8HqhaLQzN7E29Rf  you can see its confirm by fifteen or more people yet it's not showing in my wallet  what can I do about it???

this looks like an issue to your wallet software. The display from your wallet doesn't match the info you show from blockchain.info. So you need to find out, what are the keys stored in your wallet (eventually call support team), and go from there. I cn't even see which type of wallet you have, the blockchain.info wallets have a blue interface...Is it localbitcoins? Then you might ask the team there.

The address shown in Bitcoin Wallet App is a different one than the recipient address shown on the blockchain.info screenshot. Unless you created a second address with Bitcoin Wallet App, that would explain why Bitcoin Wallet App doesn't show the above payment—it went somewhere else.


text:
Bitcoin miner's earnings from transaction fee per block?
I understand the basic concepts of Bitcoin and Blockchain.
As I understand, any bitcoin transaction has a transaction fee that is user adjustable. This needs to be above a certain value which can change over time for the transaction to be recorded on a block. Currently this value is about 300 satoshis/byte.
What I can't understand is how the miner is paid this amount?
If a miner mines one block which is 1 MB in size, then the miner can record ~4424 transaction on that block (assuming ~226 bytes per transaction).
If everyone who did those transactions used the 300 satoshis/byte transaction fee this translates to ~ 3 Bitcoins.
A bitcoin block is worth 12.5 bitcoins currently. Does this mean that the miner gets ~15.5 bitcoins per block? (assuming the mining is mining solo and not in a pool)

P.S. I obviously tried searching this online and while I am sure the answer is out there but because of hot keywords like bitcoin and blockchain, most result eventually end up to articles, "What is Bitcoin?" xD

Indeed. There's nothing wrong with your understanding. See e.g. https://blockexplorer.com/block/000000000000000001a365853f7bfdef04657e945c6cb3faf4576d8933071f8e and look at the first transaction (which goes to the miner) and the fees of the other transactions.

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

sort: votes


text:
Send and receive money, payment gateway with Golang
I'm really newbie with bitcoin development, so I would like to use go for that, so

what I need for?
What libraries can I use for send and receive money, easy and secure?
Are there any examples?
I would like to do it that support user concurrency, How can I do it?

Hey Cristian, welcome to Bitcoin.SE. I don't understand your question one and four, could you please explain better what you want to do? "Payment gateway" does leave a lot of things open to interpretation. ;)

What have you tried so far? Have you done any research yourself? https://en.bitcoin.it/wiki/API_reference_(JSON-RPC)#Go

@m1xolyd1an Thanks for the example, but,  the credentials in the example are from where?

It's does mean that I need to setup my own bitcoin rpc server, really?

RPC is one option. You could also try a 3rd party API service. One an example would be blockcypher as they have libraries in golang. I am not making any recommendation for or against them, it's just an example.

Any updates on this?

There is a Bitcoin client implemented in Go called btcd which you might want to check out. This should allow you to send and receive money, if you read more about it, I'm sure you'll find plenty of examples.

It's does mean that I need to setup my own bitcoin rcp server, and after that I can develop my application using btcrpcclient, really?

If I'll develop a concurrent application, the recommendation is setup multiples bitcoin rpc servers and use load balancer or something similar to  serve de transactions, or what do you thing that is better for architecture?

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
In which order does the leveldb iterator iterate over utxos?
I would like to know in which order the leveldb iterator iterates over the chainstate entries. I aim to serialize the chainstate and have to make sure that every node can calculate exactly the same serialization (to compare its hash afterwards).

The LevelDB iterator iterates through the keys in lexicographic order. From the docs:

The preceding examples used the default ordering function for key, which orders bytes lexicographically. You can however supply a custom comparator when opening a database. For example, suppose each database key consists of two numbers and we should sort by the first number, breaking ties by the second number.

However, I am not sure that relying on the iteration order of one particular DB is what you should be using, since every other implementation would have to reproduce that iteration order for compatibility. So you would need to require a canonical ordering anyway, which can be implemented using comparators.


text:
When importing the mempool, my debug log mentions failed and expired imports
I read in my debug file:
Imported mempool transactions from disk:
143751 successes, 235 failed, 1 expired

What does failed and expired mean in this context? How can I fix that?

You can't, and you don't have to.
Since Bitcoin Core 0.14.0, the mempool is saved to disk at shutdown, and read again in the background at startup. This helps in quickly establishing a realistic mempool to help with fee estimation and compact block relay.
However, time likely has passed since the mempool was saved and when the import happens. New blocks may have been created since, which likely contain many of the transactions that are being imported. Those will not be acceptable again to your mempool, and they will be listed as failed. Other reasons may include feerate changes, or conflicting transactions that were mined. Since the mempool import happens in the background, some part of it likely gets imported after processing the blocks with whom those transactions conflict.
Transactions that are older than the mempool expiration setting (default: 14 days) don't get imported either, and get listed as expired.

I've added information on 'expired'. I hope I guessed correctly. ;)

Two slightly esoteric possiblities:

There was a reorg, and transactions have been added back into the mempool, temporarily breaching the descendant / ancestor limits. When the node then restarts, some txns breaching the limits will be dropped.
There was a CPFP carveout, leading to a cluster of 26 transactions, and then the node restarts. Since the carveout is only possible with a specific order of transaction arrival and the txns could be loaded in a different order, a transaction could be dropped and marked as failed.


text:
How to add own cpp-files to Makefile
I successfully managed to compile bitcoind using the shipped configure script/makefile. Now I want to code something myself and added a folder inside the src directory. The problem now: how do I add my cpp files to the Makefile? When compiling, I get undefined references to functions I implemented inside my cpp files. When looking inside my folder, there are no .o files or anything similar, so I assume they are not compiled. I am completely novice to autoconf/automake and have no idea how to add something to those complicated makefile/configure scripts..
Best wishess to all of you

Bitcoin uses the autotools build system in order to build the source code.  It is a very powerful, yet notoriously confusing system.  You will need to edit the Makefile.am file to include the source files you want to build, and to point the linker to compiled sources.  You will then need to rerun parts of the build system (automake, ./configure, etc...) in order to regenerate Makefile.
The specifics for how to do this are difficult to say, since you will need to determine which parts of the system your new code depends on, and which parts depend on your new code.  I suggest reading up on autotools, determining what is needed for your particular code changes.

Thank you very much for your answer, but I am still not able to add my file to Makefile.am. When taking a look at that file, I cannot find any place where a .c/.cpp file is mentioned. I also tried to rerun autoscan/autoconf/automake only getting worse and worse :(

@GladHeAteHer, bitcoin is a complex project.  The root Makefile.am will list subdirectories which contain their own Makefile.am files, which in turn point to other subdirectories with other Makefile.am files.  It is in these files where you need to add your new files.  As I said in the answer, the specifics are going to be determined by what you are changing and in which order it needs to compile.  I highly recommend learning more on autotools before continuing.

Thanks, I found another Makefile.am to which I could add my own .cpp files and it works now :)


text:
Can I change wallet without shifting funds
I have some fund in Multibit, a wallet that has now become almost unusable. I do not want to risk transferring all my bitcoins to another non-Multibit wallet because my last transaction is still stuck in "sending" mode weeks after I sent some bitcoin.
So I am wondering if it is possible to sign up with another wallet provider and somehow recover my Multibit funds directly from the blockchain.

Yes you can, depending on what version of multibit you have, you can do the following :

Multibit HD: You should have the backup seed words. You can directly use those seed words / master public key to create a new wallet like mycelium/electrum
Multibit Classic: Export out all the private keys https://multibit.org/help/v0.5/help_exportingPrivateKeys.html. You can import these private keys into the new wallet

Installed Electrum (Linux) and used restore option. Used my 12  Multibit HD words and created a new wallet. It is empty. Checked Multibit and the funds are still here. What am I doing wrong?

Ok correction. Seems like you ran into HD wallet compatibility issue due to different derviation paths. Check the mnemonic compatibility sheet here  https://bitcointalk.org/index.php?topic=1000544.0.  You can try with Mycelium.

I checked the link and it looks as if it is a work in progress. I will try Myceilium and report the result.
Let us suppose Multibit is not compromised but simply stops supporting its customers. What happens to the funds? Is blockchain network robust enough to allow wallet holders to recover their funds (in another wallet such as Mycelium) bypassing Multibit altogether?

Both multibit/mycelium is open source and not a website. They use SPV to interact with blockchain network

@darkknight: I think you may be able to answer this question: https://bitcoin.stackexchange.com/q/54447/5406 Could you please take a look?

@Murch Thanks a lot for the mention. Caught up with something these days. Will try to answer as soon as I get time.


text:
Unconfirmed transaction for 17 days
https://blockchain.info/tx/e50d760324d5ef982f8566a0a3cd9e1233c8b77aeea53ee72af77c12328b1374
I sent this transaction 17 days ago through the Blockchain Online Wallet and it's still unconfirmed.
I tried ViaBTC accelerator but it always says "Submission are beyond limit."
I've also read about some other solutions but they seem very technically complex and potentially dangerous if you don't know what you're doing.
Please help.

Visit https://pushtx.btc.com/#/ and pay 6 $

Research how to construct replace by fee transactions. E.g. Samurai wallet has it integrated.  Or wait for a month and your transaction will be dropped from the memory pool.


text:
How long would it take for me to mine a bitcoin with a TItan XP nvidia
How long would it take me to mine 1 bitcoin with an nvidia titan xp graphics card?
ty for helping if u do.

Wait so if this isnt good what should I use to be able to result in the maximum efficient to get bitcoins. I am willing to spend around 2k-3k dollars.

See the link in my answer. It's a bitcoin mining hardware guide that gives you the price for each piece of hardware along with how much bit coin you can expect to mine. Keep in mind this is constantly changing.

In short: don't.
The hardware comparison page on the (mostly outdated) Bitcoin wiki does not have information on the Titan XP card, but lists around 200 Mhash/s for the GTX 590. A GTX 590 has 1024 CUDA cores, while the Titan XP has 3840. Extrapolating using this, we can estimate the performance at around 750 Mhash/s.
At the current difficulty, that amount of hashrate will let you mine a block on average once per 135000 years. If you use pooled mining, you can get incremental payouts for shares (partial proof of work). You may earn 1 BTC around once per 10000 years, while paying around $2000000 in electricity costs during that time (at 10c/kWh).
So don't. GPU mining has been superseded by FPGA and ASIC mining since around 2013.

And this is even assuming that the rewards and difficulty remain constant. So the reality is even worse than this.

A long time. It's not really feasible to mine bitcoins with gpus anymore as there are special purpose asic chips now used to mine.
According to this link

CPU mining eventually gave way to GPU mining (where 1 GPU = ~28 CPUs)¹
GPU mining eventually gave way to FPGA/ASIC mining (1 ASIC first-gen = ~33 GPUs)¹
ASIC mining rapidly improved until running headlong into Moore’s    Law (1 ASIC today = ~212 ASICs first-gen)

Here is a list of what's currently used to mine bitcoin (2017).


text:
Trezor Simple recovery vs advanced recovery
Are there any security risks or advantages/disadvantages to using the simple recovery process vs the advanced on a trezor? Is one better than the other?

The simple recovery leaks the seed words to a keylogger but not their order.  The advanced recovery is completely safe against keyloggers (as long as there is no camera pointing to the Trezor screen).
The simple recovery asks for the words in random order.  Since the words need to be entered on the computer, a keylogger can see them.  An attacker could then try the words in all orders to recover the seed.  For the usual seed length of 24 words this is still too computation intensive to be profitable, but for seeds with only 12 words it is possible to find the right order in a day on a normal computer.
The advanced recovery uses a similar method to the PIN matrix entry.  It asks for each word (in correct order) by giving nine choices where it is in the alphabet, see this blog post with screenshots.  The computer displays nine unlabelled buttons and the Trezor screen shows the meaning of the button.  When the user presses a button, the position of the button is sent to the Trezor.  A keylogger can only know which button was pressed but since the randomization is done completely inside the Trezor, the keylogger can't know which choice the button corresponds to.  Since every word is chosen by exactly the same four questions (three times a 3x3 matrix and then a 2x3 matrix with the remaining candidate words), there is no information about the seed leaked to the computer.  The only disadvantage is that it takes more time and is more difficult to use.


text:
Off-chain transactions with Coinbase
Recently I created an account/wallet on coinbase.com. Then I transferred my BTCs I already had from blockchain.info to the wallet on Coinbase.
A bit later I bought some new bitcoins directly from Coinbase with my credit card and I expected that I'm able to see something like a transaction ID and a block reference once the new BTCs arrived in my wallet.
Interestingly I got the BTCs but there's no transaction of block reference as expected.
On support.coinbase.com they say:

You can view most digital currency transactions on the network's respective blockchain, which records and verifies the legitimacy of transactions. However, when transferring from a Coinbase account to another Coinbase account, the transactions occur off the blockchain. […] For these "off-chain" transactions, you won't be able to view the bitcoin transfer in the blockchain, and there won't be an "Advanced Details" link when you click on the transaction.

As far as I understand the bitcoin blockchain the idea behind the whole thing is that everybody knows how many bitcoins I own (yes I know, my identity are hash addresses).
But if there's something like off-chain transactions this means that I don't own the BTCs I bought with my credit card, from a technical point of view because no one (the distributed ledger) know's about this transaction.
Is this correct?

I would love an answer too. Good question.

From the perspective of the Bitcoin network, Coinbase owns both the Bitcoins you transferred in, and the Bitcoins they sold to you.
This is useful from a technical perspective, because Coinbase can have as many transactions within their system as they want, and no-one outside of Coinbase needs to keep track of them.
This is problematic because Bitcoin can't give you any guarantee that Coinbase won't take your Bitcoins, and Bitcoin can't give you any guarantee that Coinbase has enough assets to pay all of their account holders.
Coinbase could publish an audit showing how much Bitcoin all of their account holders are supposed to have, and signed statements showing control of enough Bitcoins to cover those obligations, though.

That‘s what I expected. I also moved back again from Coinbase to Blockchain.info because it‘s not the idea and the concept behind Bitcoins to give control about my money to someone else.

Yes, you have a fully custodial account on Coinbase, thus Coinbase is holding your bitcoins for you. When a customer buys bitcoins or receives a payment from another customer of Coinbase, Coinbase only updates their balance sheet to track their debt to you. This has the advantages that they can forgo to create an on-chain transaction which costs them money (which ultimately is paid by the customers), it allows them to provide instant transactions between their customers, and they are insured against losses which you aren't. As you have correctly identified this has the disadvantage that there is no proof that the money has actually been set aside for you. Note that even if they sent the coins to an address associated with your account, they'd still control the private keys and would be in full custody.
To take full ownership of your coins, you could withdraw them from Coinbase to a wallet with which you control the private keys.


text:
Bitcoin Sellers who Request Photo ID, is this safe?
I wanted to comment on this but couldn't due to low rep:
What's the safest way to buy bitcoins in the UK?
Looks like quickbitcoin.co.uk is a good place to buy bitcoins, however; I'm not comfortable sending my driving licence or other ID.
Why do companies/sellers of crypto currency want photo ID of customers?  Is it safe?

Cryptocurrency companies generally require photo identification to protect the company. The legal concern of exchange of cryptocurrency is money laundering, and by requiring identity verification, you know who you're receiving currency from or giving it to. Of course, companies will also need to have procedures in place to detect identity fraud. Some exchanges will require you to provide a picture of yourself holding your photo identification.
As for whether it is safe or not, it really depends on how trustworthy people believe the company is.


text:
Warning: Reducing -maxconnections from 1000 to 865, because of system limitations
I want to be the fastest/first one at recognizing/receiving new transactions, so i set i set these in bitcoin.conf and running a bitcoin full node on dedicated centos server.
maxconnections=1000
timeout=15000

ref : How does one attain 1,000+ connections like blockchain.info?
but when i restarted the bitcoind i get
Warning: Reducing -maxconnections from 1000 to 865, because of system limitations.

why is that ? and how can i connect to maximum nodes to make sure i am the first one to get new transactions details.
bitcoin version
Bitcoin Core RPC client version v0.14.99.0-6adc3a3

Connecting to more nodes will not make you learn about transactions faster, after some point.
Your node will just be busy processing messages - including many uninteresting ones - to maintain connections with all peers, making it slower at processing new things.
Connect to a few fast peers with -addnode, or even run multiple nodes yourself, and interconnect them to each other. That will be faster than connecting directly to everyone.
The reason for the reduction of max connections is due to the limited number of file descriptors the operating system granted your bitcoind process. You can use the ulimit shell command to increase the maximum file descriptor.

where can i find list of fast peers ?

Look for yourself. Run a node for a while, see which ones have low ping times, ...

what if i copy all nodes from https://blockchain.info/connected-nodes and do -addnode on my node, to force connect to all nodes ?

You can't -addnode more than 8 peers.


text:
What do I support with Bitcoin Core Version 0.14.2
At the moment I'm following the discussion about BIP-141, BIP-148, SegWit and SegWit2x (NYA). But I'm confused.
I'm running Bitcoin Core Version v0.14.2 as a full-node. It's currently downloading the blockchain (should finish in 40 hours). So I count as a user (in regard to the term user activated soft fork) what means that I have a vote.
Now I'm wondering what I'm supporting by using version 0.14.2?

You can look at the version field of blocks generated by that software, there are websites that show both the client and version.
To my knowledge, core supports bip141, which is SegWit (bit 1 of version)
Core does not support bip91, nor bip148, nor Segwit2x (2mb hardfork)

Note that BIP148 and BIP91 are soft forks without impact on transaction validity. This means that any software - including Core - that does not support these forks will accept the longest valid chain, regardless of whether these rules get adopted by the network.


text:
Application of proof of work in bitcoin
Proof of work in spam
I understand very well how proof of work is used to prevent email spam for example. Reasoning is since computing the right hash (e.g. with predefined number of zeros for example) for a single email is expensive, it will not be desirable for people sending spam to million recipients to compute that hash for each email. Now this reasoning makes perfect sense.
Proof of work in bitcoin
However, I don't know how the proof of work system is used in bitcoin, more precisely:

which problem does it try to solve
and more importantly how does it solve this

Can someone explain it (in layman terms)?

possible duplicate of https://bitcoin.stackexchange.com/questions/51286/why-do-we-need-proof-of-work-in-bitcoin?rq=1

@NickODell Maybe but the answer there gave me nothing (I put a comment even there)

To have a useful payment system, if I have some asset the system supports, I have to be able to send it to Alice if she is a user of that system. And I also have to be able to send it to Bob if he is a user of that system. But if I can do both of these things, the system stops being useful. So, for bitcoin, somehow sending bitcoins to Alice must prevent me from sending them to Bob and vice versa.
Traditionally, this would be accomplished by a central authority. For example, my bank can process checks in the order it receives them, approving them if I have a sufficient balance and deducting that amount from my balance. The bank can prevent me from sending the same money in two places. But bitcoin has no central authority.
Bitcoin's solution has several pieces.
First, it groups transactions into blocks. Second, it chains blocks into a blockchain.
Third, it has rules for what is or is not a valid blockchain. For example, a chain that includes two conflicting transactions is not valid. So, in my example, either a blockchain can include my payment to Alice or my payment to Bob, but not both. This works because all transaction and state information is public, so nobody would ever accept any blockchain with conflicting transactions unless they chose to foolishly harm themselves.
But we still have one problem left -- how do we ever get everyone to agree on which blockchain is valid if there's one that includes the payment to Alice and one that includes the payment to Bob? That's where proof of work (mining) comes in.
It consists of two steps:
1) To add a block to the blockchain, you must do a very large amount of computational work.
2) You will be rewarded with bitcoins for doing this large amount of work, but only if the blockchain that contains the block you added becomes the one everyone agrees on.
And lastly, one more rule: We agree on that valid blockchain that has required the most computing power to generate.
Under reasonable conditions, this assures that everyone will eventually agree which of the two transactions is valid. Miners are incentivized to build on the longest, valid block chain they know of, because that gives them the best chance of being rewarded. Thus longer chains will tend to get longer and shorter chains will tend to be ignored. Eventually, one chain will be so much longer than every other chain that we everyone is mining on top of it and nobody is mining on top of the other and there is no chance the shorter chain will ever be longer.
Once that happens, and the longer chain contains one of my two transactions sufficiently deep in the chain, we can all agree which way my bitcoins go. And no central authority is needed.

I am sorry but I fail to see what problem POW solves from your answer and HOW it solves it? in spam it is very clear, please pay attention to it: since you have to compute POW for one email, then for spammers it is not worthy to compute POW for 100000 emails because it will take too long. Now here one can clearly see how POW prevents spam. I fail to see similar analogy in bitcoin.

It's precisely the same thing. Say the longest blockchain contains the payment to Alice. If an attacker wants to make a longer blockchain with the payment to Bob, he has to compute lots of POW to make his blockchain longer (he has to start from a block before the one with the payment to Alice). And he'll be the only one doing that as everyone else in the world is working on the longest blockchain and he's the only one working on the shorter one. Meanwhile, any blocks he produces earn him nothing since they'll never be part of the longest blockchain.

Or to put it more simply: You get paid for making the longest blockchain longer. Thus the longest blockchain will tend to get longer very, very quickly as everyone is making it longer. So a payment in a block will rapidly be buried deep in a blockchain that is clearly the longest and so can be reasonably assured to always be in the longest blockchain. We all agree to consider a transaction valid if it appears in the longest valid blockchain.

Now this makes a little bit more sense but I am still fuzzy about it, maybe that is because I am not familiar with the rest of the bitcoin protocol?

Maybe. One of the things that makes bitcoin particularly hard to wrap your head around is that every concept depends on every other concept. So you kind of have to get a rough idea of what everything is, then firm up concepts in rotation, and keep going until you get it all well.

@DavidSchwartz, I think that fair currency distribution in pseudo-anonymous system is also an important problem which PoW solves.

@sanket1729 I would agree that it does perform a currency distribution. However, I don't think there's anything particularly fair about it. Giving money to whoever wastes the most electricity performs a distribution, but would you call it fair?

which problem does it try to solve?
Imagine a P2P system in which all nodes are connected. Now, any peer can propose a block(these set of transactions) and say that it is valid and should be added to blockchain(the ledger containing these blocks). Now, the question which peer proposes this new block? . If we randomly choose a peer to propose this block, it is vulnerable to sybil attack(create multiple nodes).
Enter PoW(Proof of Work): We approximate selecting a random node by instead selecting nodes in proportion to a resource that we hope that nobody can monopolize. What does that mean? Well, if that resource that we're talking about is computing power, then it's a proof-of-work system where we somehow select nodes in proportion to their computing power.
I would call PoW is a sybil-attack resistant method for choosing a block to propose the next block. Just like SPAM protection, it is SPAM protection from choosing a peer to propose the next blocks. Other parts such as block rewards, double-spend etc are related to game-theoritic incentives. I hope you can relate it with email spam protection
EDIT:
In SPAM protection: you prevent sender from making a DOS attack on servers by forcing them to provide a valid PoW for every message. This prevents from DoS attacks of many sybils. Here, you choose only the valid messages which are to be processed by your server. You pick winners(valid messages) from spam you recieve.
In bitcoin: It is a method for deciding which block should be the next block. You choose winners(only 1, the first one to provide valid PoW) from the many blocks which peers may propose.

spam example is clear to me - this not

In email spam, you prevent people from spaming by forcing them to provide PoW to each email. Here, to propose a block, you are forced to do PoW for a block. Without PoW, it is unclear how to choose the next block for blockchain in a sybil-resistant(https://en.wikipedia.org/wiki/Sybil_attack) way. In SPAM protection, you only accept emails which a valid PoW(preventing mails from meaningless peers) and in bitcoin, you only accept blocks which have valid PoW.

@user200300, please have a look at updated answer

in spam POW helps you because it is not worthy for spammers to compute pow for 1000000 of emails (takes too long). how does that apply in bitcoin? why POW prevents sybil?

Proof of work enables distributed-trustless consensus and solve the doublespend problem.
After the transaction validation, all miners try to create a new block by finding a number that creates a hash with certain properties. It is nothing but a puzzle that is resource intensive so that only the "worthy" can add a new block to the block chain.

Why is it compute-intensive?

The reason why it is compute-intensive is, that not anybody could add that block. And let's say I want to double-spend my bitcoins, I could create that block myself. But anyone else with a higher hash-rate or "a better CPU" can say that the transaction added is invalid and would not promote the chain with invalid transactions, instead will add blocks with valid ones.

Now with enough miners on the network,

the proof of work helps to add the correct block. Anybody who wants to add an invalid block, should have a mining power of at least 51% of the network, and in doing that if possible the miner will spend resources that he wouldn't gain out of adding that invalid block, because he will have to keep adding blocks in competition of all the other miners to make his chain "the longer chain" indefinitely.

I am sorry but this is a terrible explanation.

compare this explanation with the explanation I gave about SPAM filters. Is there a difference in terms of clarity? Which is easier to understand?

And to add to 'how it works':
If a miner wants to create a new block, it has to find a hash as stated by nakulchawla09. The difficulty to find this hash is controlled by the bitcoin protocol in a way that a block is mined every 10 minutes.
The hash that needs to be found is based on hashcash puzzles, just like in spam protection. The difficulty is set by determining the amount of zero bits the hash needs to comply to.
Now, the first miner to find a correct hash gets a bitcoin reward (currenty 12,5 BTC).  So there's an incentive to find a correct hash. Correct hashes can be verified fast by other nodes and don't require a lot of hashing/mining power.
So basically PoW helps to fuel a reward system for processing transactions at a controlled pace. Controlling this pace is desirable because nodes need time to process information.

i am not interested how it works rather how it solves the problem for which it wad employed

Proof-of-work in Bitcoin limits the frequency with which the blocks are added. The target frequency is one block per 10 minutes. Without proof-of-work, computing a valid block would be almost instant. The difficulty (number of leading zeroes required for a block to be valid) is adjusted every 2016 blocks depending on how fast the last 2016 blocks were produced, therefore adjusting to changes in the hashing power of the network. Instead of having a block mined every 2 minutes should 5 times as much hashing power be employed, the difficulty will raise to limit the frequency to as close to 10 minutes as possible.


text:
How to do sendRawTransaction to bitcoind JSON-RPC using bitcoin-core package in nodejs
I am trying to do
sendrawtransaction <transaction_hex>

from nodejs using bitcoin-core package
i did
npm install bitcoin-core --save

i already have latest bitcoind setup and running with rpcusername and rpcpassword are set in bitcoin.conf
my current code looks like this.
const Client = require('bitcoin-core');
const client = new Client({ username: 'adminuser', password : 'adminpassword'});

client.getInfo((error, help) => console.log(help));

i have managed to only get response from getInfo
everything else gives either empty output or undefined or null

so far i have tried many variations like these
tx_hex = "0200000001949e0e3ac02fef76dffa8e2191ee0041f71a90c5ec9bbcba77db5f57e49fe6dd010000006b483045022100d6ac8520a1cfe80f6f3c2fbe6c3f903894203715928382e77c3c7ad0de74112502203c14601e5195dde88c9cc16c45dc273af168bd4fd03b6c045f832b7ba0134f8c012102183e719a510ff322fcb0dbfa279ef2500dd87c0b8c6184480846262e1949fbebfeffffff028bec0900000000001976a9141b0c5cb82d59cb2e07e8d5e343167fda48a9d60e88ace2920f00000000001976a9148108670170211830be2c3c557afe6bc2205d27de88ac864a0700"

client.sendRawTransaction((tx_hex,response) => console.log(response));

client.sendRawTransaction((tx_hex) => console.log());

client.sendRawTransaction((tx_hex), function(){console.log()});

but none of the above gives confirmation, or gives proper output.
what am i missing here ?
i mean if i were to do this using bitcoin-cli on terminal it returns txhash .
e.g.
[root@localhost deploy]# bitcoin-cli sendrawtransaction 0200000001949e0e3ac02fef76dffa8e2191ee0041f71a90c5ec9bbcba77db5f57e49fe6dd010000006b483045022100d6ac8520a1cfe80f6f3c2fbe6c3f903894203715928382e77c3c7ad0de74112502203c14601e5195dde88c9cc16c45dc273af168bd4fd03b6c045f832b7ba0134f8c012102183e719a510ff322fcb0dbfa279ef2500dd87c0b8c6184480846262e1949fbebfeffffff028bec0900000000001976a9141b0c5cb82d59cb2e07e8d5e343167fda48a9d60e88ace2920f00000000001976a9148108670170211830be2c3c557afe6bc2205d27de88ac864a0700
b9ceb300bc4a94dad591d8ecca7e840e7cfafa47c029488424e07666c1e1778b

update1 :
tx_hex = "0200000001949e0e3ac02fef76dffa8e2191ee0041f71a90c5ec9bbcba77db5f57e49fe6dd010000006b483045022100d6ac8520a1cfe80f6f3c2fbe6c3f903894203715928382e77c3c7ad0de74112502203c14601e5195dde88c9cc16c45dc273af168bd4fd03b6c045f832b7ba0134f8c012102183e719a510ff322fcb0dbfa279ef2500dd87c0b8c6184480846262e1949fbebfeffffff028bec0900000000001976a9141b0c5cb82d59cb2e07e8d5e343167fda48a9d60e88ace2920f00000000001976a9148108670170211830be2c3c557afe6bc2205d27de88ac864a0700"

client.sendRawTransaction((tx_hex,response) => console.log(tx_hex + ':' + response));

returns
RpcError: -1 sendrawtransaction "hexstring" ( allowhighfees )

Submits raw transaction (serialized, hex-encoded) to local node and network.

Also see createrawtransaction and signrawtransaction calls.

Arguments:
1. "hexstring"    (string, required) The hex string of the raw transaction)
2. allowhighfees    (boolean, optional, default=false) Allow high fees

Result:
"hex"             (string) The transaction hash in hex

Examples:

Create a transaction
> bitcoin-cli createrawtransaction "[{\"txid\" : \"mytxid\",\"vout\":0}]" "{\"myaddress\":0.01}"
Sign the transaction, and get back the hex
> bitcoin-cli signrawtransaction "myhex"

Send the transaction (signed hex)
> bitcoin-cli sendrawtransaction "signedhex"

As a json rpc call
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "sendrawtransaction", "params": ["signedhex"] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/
:undefined

The way you pass parameters is wrong. I use the code below, got the right answer:
const Client = require('bitcoin-core');
const client = new Client({username: 'admin', password: 'password', network: 'testnet'})

const txHex = '0200000001999539009d0d02f2332d257716faa75cc4c9a8318c153ba6a084c719fa33103b000000006a4730440220032470b6b45825fc37d08e1985c7ad2044272edacfa2c76cf49c6b70c09a0dac02202466ede3e660c6d57f65b7ed21f2c1f778116ef92bef9ed2f9b18fcb1881a7b9012103b91ff254ae3bb3861e4a6c16ab356d6c52ccfd2b58bedf0dda84657dfd9d9afcffffffff0130750000000000001976a914ba05ece7632d78336848214b525cfdbd1c4b06a188ac00000000'

client.sendRawTransaction(txHex, (error, response) => {
  if (error) console.log(error);
  console.log(response);
});


text:
can sender send 2 amounts to single recipient in single transaction?
I am working on web-app that needs to send money to customer's addresses.
i am trying find out if is it possible to ,
Bitcoin sender to send 2 or more amounts to single address in single transaction ?
e.g.
Transaction 1->
               sender1 -> (20 satoshis)-> receiver 1
                       -> (40 satoshis)-> receiver 1

Is this possible ?
i know i can add both amounts and do single transaction. but i would like to know can this be doable ?

note that transactions with any output under 546 satoshis will not be relayed (the rules are a bit more complex, but for a standard tx, that's the threshold).

Yes. This sort of transaction is doable in bitcoin.
A point which I would like ot highlight is that transaction fees in bitcoin are proportional to the transaction size in bytes(and not the amount being sent). So, splitting the amount into 2 outputs will cost you more than combining the outputs.

are there any examples of this type ? on prolly blockchain ? how can i find them ? thanks

There is nothing special about having the same address appear in two different outputs. This example shows simple multiple outputs in a transaction, you would instead have same pubkeyhash in 2 outputs https://blockchain.info/tx/be4d79051eefbb70c5269e7f2410d695cd9a0cddb583e6ec18b29bbc77f8fc14?show_adv=true.


text:
How many txid gets added to mempool per second?
I am trying to get the txid using json/rpc and trying to find out how many tx_id gets added to memory pool ?
i think it comes down to how many bitcoin transaction are possible per second ?
is there any fixed number ? or maximum number ?

On a long term average the number of transactions is limited to the number of transactions that can enter the blockchain-- so roughly 7tx/s before segwit and 14tx/s after segwit activates.
But on a short term basis while the mempool fills or with transactions being replaced the rate can be as fast as your node can process transactions.  On reasonably fast hardware this can easily hit a few thousand per second.
But you won't normally see rates like this in practice unless someone attacks you or someone does something strange, especially since most nodes limit their instantaneous relay rate to a small multiple of the long term average transaction rate.  When a new node starts up it only gets newly arrived transactions, though a misguided or malicious peer to could advertise every transaction they know to you as soon as you come online in order to hit that peak rate (at least until your mempool fills).

does all transactions gets added to all nodes mempool ? at initial start of bitcoind ? where does the transactions comes from ? at the rate of few thousand per second ?

I revised the answer to respond to that follow on question more clearly. Make sense?


text:
Bitcoin Cash sendrawtransaction error?
I am trying to send a raw transaction from my Bitcoin ABC node.  It is not fully synced, but I have at least passed the point where I can see some of my transactions.  In trying to send a tx after creating it, I get the error:
16: mandatory-script-verify-flag-failed (Illegal use of SIGHASH_FORKID)

What is this, and how can I resolve it?

I have actually done this and it is not advisable. Fortunately for you your tx was rejected. What happened in my case is that the address I tried to send my BCC to ended up sending to a bitcoin address of the same ID. I'm guessing you were smart enough to use a backed up version of your wallet.dat/had swept those funds into a different address (on bitcoin).
I would wait for sync before trying to send anything... I don't think you have much of a choice (maybe other client)

It looks like the error message for receiving a legacy transaction on a Bitcoin ABC node: https://github.com/Bitcoin-ABC/bitcoin-abc/blob/174846aaaf564e64b6bd06d679996b52ba86ad53/src/validation.cpp#L1445
Speculation:
It seems plausible that Bitcoin ABC would create regular transactions before reaching the fork in order to retain compatibility with the Bitcoin network, but then recognizes them as being invalid to the upgraded network. (This is unverified speculation.)

I have been given a similar answer elsewhere.


text:
Is there a maximum fee per byte in satoshis?
i have seen recent transactions with fees as low as 1.065 satoshis per byte.
and some transactions with fees as high as 500+ satoshis per byte.
so i would like to know is there maximum fee ? in satoshis per byte ?
can i do transaction of 100 btc with setting 99 btc as fee ? (with only 1 input and 1 output. )

Yes you can, there is no maximum limit for the fee. The fee is simply the difference between the sum of the input values and the sum of the output values, so if you wanted to donate 99 BTC to the miners there is nothing stopping you - no idea why you'd want to donate an entire house though ;)

Bitcoin Core has a hard limit for what it considers to be an absurdly high fee.
That limit is 0.1 BTC Any transaction that pays more than 0.1 BTC in transaction fees, regardless of the fee rate, will be rejected with this error 256: absurdly-high-fee . It is not consensus invalid, it is just non-standard.

This isn't correct.  Absurdly-high-fees are not non-standard.   The wallet/rpc interface will reject them unless given an argument to override, but on the network they're be relayed and mined just fine.

@G.Maxwell Actually that's Andrew answer on https://bitcointalk.org/index.php?topic=2692430.0

That doesn't make it any less incorrect.

https://github.com/bitcoin/bitcoin/pull/2949  here is where the functionality was introduced

so its just limitation in bitcoin-core, what if i create raw transaction broadcast it to the   bitcoin network using other services., then it will be relayed.

Yes, that's right

At the moment no more than 17662867.32455670 BTC exist. A transaction can't be smaller than 63 bytes so the "maximum feerate" would be 28036297340566.19 satoshi per byte and increasing with each block.

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Does more fees means quicker transaction ?
lets say hypothetically , two persons having access to same private key. makes a transaction with 1 input and 1 output.
person 1 sets fees = 500 sat/Byte
person 2 sets fees = 10 sat/Byte

case 1 :
both the persons broadcasts transaction  at the exact same time.
Which transaction goes through and which gets marked as double spend ?

case 2:
person 2 (with lower fees) broadcasts at 0 second
while
person 1 (with higher fees) broadcasts at 1 second
Which transaction goes through and which gets marked as double spend ?

There is no definitive answer.  Each miner can make their own decision to include either of the two transactions (or neither) in either case.  Whichever miner is lucky enough to find the next winning nonce, their decision determines which transaction is confirmed.  (If that miner chose neither transaction, then the can is kicked down the road.)
In practice, a miner's "decision" depends on the algorithm used by their mining software.  A "greedy" algorithm might choose the higher-fee transaction in all cases; if they get the lower-fee transaction first, they would initially include it in their candidate blocks, but then replace it with the higher-fee one if that one arrives later.
A "naive" algorithm might just choose the first transaction which is seen by the miner, and not replace it by a later transaction, even if the fee is higher.  (Even if they are sent at the same time, the miner has to process one of them first; this might come down to infinitesimal differences in network propagation, and make the choice practically random.)
You could also imagine more perverse algorithms that always choose the lower fee, or the later arrival, or make the choice in some other bizarre way.
There's also the possibility that a miner receives one of the transactions, adds it to their candidate block, but finds a winning nonce for that block before the second transaction arrives.  In that case, they would presumably already have published their winning block, so they can't do anything with the second transaction even if they want to.
I don't know whether there are any statistics as to what fraction of miners use which algorithm.


text:
Do i have to run full node to receive unconfirmed transactions?
i want to query unconfirmed transactions by using getrawmempool.
do i have to run a full node ?
or if i set prune in bitcoin config, will i still get the newly unconfirmed trsanctions ?

As far as I know, this should work just the same even with pruning enabled.
A Bitcoin Core node with pruning really still is a "full node" on the network; it relays transactions and fully checks the validity of incoming transactions and blocks.  The only difference is that without pruning, received blocks are stored forever and can be shared with other nodes who are initially downloading the chain.  With pruning, all blocks are downloaded and checked but only newer blocks are stored and shared.  Everything else should be the same.

i would love to confirm this. it can save me some 150 gigs of hdd space.

Yes, you can prune just fine. Pruning just means you can't serve old blocks to peers in the network, and you can't rescan for old wallet transactions. Everything else will work the same whether you prune or not.


text:
Which code part in bitcoin-core project generates new bitcoin addresses?
i am trying to find out which c++ code in https://github.com/bitcoin/bitcoin
is responsible for generating bitcoin address and private key.

See CWallet::GenerateNewKey in src/wallet.cpp.  It calls either DeriveNewChildKey or MakeNewKey depending on whether HD wallets are in use.


text:
Where can i download latest stable bitcoin-core src files?
i want to download latest stable bitcoin-core src files. and want to build it on my system from source.
here is latest src of bitcoin-core but its not stable for production ready environment.
https://github.com/bitcoin/bitcoin

https://bitcoin.org/en/download shows latest version as
Latest version: 0.14.2

so where can i download src files of version 0.14.2

The Bitcoin Core source code is in a git repository. The repository has multiple branches and tags. The branches are source trees for a major version (e.g. 0.14 releases) and tags are for individual releases.
If you want to use the latest stable version of Bitcoin Core, run the following command:
git checkout v0.14.2

If you want to use the latest source for the 0.14 version series, use
git checkout 0.14

As you can see here the latest version is now the more stable version. As the most recent changes are for bug fixes, etc.

This is a new minor version release, including various bugfixes and
  performance improvements, as well as updated translations.

If you download a previous version this version may contain those fixed bugs.


text:
Where can i download latest stable bitcoin-core src files?
i want to download latest stable bitcoin-core src files. and want to build it on my system from source.
here is latest src of bitcoin-core but its not stable for production ready environment.
https://github.com/bitcoin/bitcoin

https://bitcoin.org/en/download shows latest version as
Latest version: 0.14.2

Update 1 :
Looks like git checkout is what i am looking for.

hmmm, 14.2 is latest version, stable. What do you mean by not being stable for your production environment?

@pebwindkraft i did git clone https://github.com/bitcoin/bitcoin , compile, build after running and doing bitcoin-cli getinfo i am getting  "errors": "This is a pre-release test build - use at your own risk - do not use for mining or merchant applications"

git clone git@github.com:bitcoin/bitcoin.git
git checkout tag_name

the latest version must be v0.15.0.1 now. so the command is :
git checkout v0.15.0.1

You have to know which version is currently 'stable'. It's currently the 0.14 version. Just checkout the 0.14 branch from github. This will track 0.14.x versions.
You git pull and then make. Simples!

git clone git@github.com:bitcoin/bitcoin.git

git tag

Find latest stable version (without "rc" on its name)
git checkout tag_name

*"rc" stands for release candidate


text:
How to make sure, Bitcoin private key and bitcoin address generator tools are generating valid key pair?
I find lots of tools/scripts written in python which can generate random number then using this random number it generates Bitcoin Private key(WIF) -> Bitcoin Address pair.
I have tried verifying few pairs using www.bitaddress.org >> Wallet Details by entering WIF key and verifying with output address.
But How can one make sure, the tools/scripts will always generate valid address and key pair ?
or is this like this way
if it generates one valid address and key pair it means all the future address and key pairs will be valid ?
i was looking at this https://github.com/shirriff/bitcoin-code
from makeAddr.py
import random, keyUtils
private_key = ''.join(['%x' % random.randrange(16) for x in range(0, 64)])
print keyUtils.privateKeyToWif(private_key)
print keyUtils.keyToAddr(private_key)

i know random number/string generated using this method is not very much secure, but i am talking in terms of valid WIF and address pair.

Read the rfc's and write your own is only real way. There could be bugs? But outside of that this is good question. I think bitcoin.org recommends some.

you need to make sure that the private is lower than 1.158 * 10^77 (115792089237316195423570985008687907852837564279074904382605163141518161494337) and
In your case you could do
 import random, keyUtils
 private_key = ''.join(['%x' %random.randrange(16) for x in range(0, 64)])
 print keyUtils.privateKeyToWif(private_key)
 print keyUtils.keyToAddr(private_key)

 from ecdsa.curves import SECP256k1
 decoded_private_key = int(private_key,16)
 if decoded_private_key > 0 and  decoded_private_key < SECP256k1.generator.order():
     print 'valid'
 else:
     print 'invalid'

File "mycode\bitcoin-code-master\makeAddr.py", line 8, in
if decoded_private_key > 0 and  decode_private_key < SECP256k1.generator.order():
NameError: name 'decode_private_key' is not defined

dang, idk how i too missed that.


text:
Cost/space effective transaction?
Is there a more, or most, cost/space effective way to create a transaction with say 100 outputs and 1 input?  Is there a limit to the number of outputs in a transaction (aside from any limitation upon blockspace)?

There is no explicit limit on the transaction outputs, however, transactions bigger than 100kB are non-standard and will not be relayed by most nodes. As P2PKH outputs are 34 bytes, you'd be able to create a transaction with more than 2,900 outputs.
Since I don't know what your use case exactly is, note that if the outputs are too small, they might make the transaction non-standard (when they are below the dust threshold), and even above that threshold it could be cost prohibitive to spend very small outputs at current fee levels.

More cost/space effective than what? It's not possible to create outputs without physically encoding them into a transaction, not sure how you are thinking to reduce the space they take up.
Such a transaction would be highly discouraged on principle because it increases the UTXO set by a huge factor, even though there is no explicit limit. Scaling of the UTXO set is perhaps one of the most important issues to think about for the future of bitcoin, it's preferable to reduce the set rather than increase it because all full nodes keep the full set in fast memory to validate new transactions, so a large set is quite a burden. Under what circumstances would you need to make such a transaction?

More cost/space effective than say a P2PKH transaction.  Perhaps a Segwit transaction would help with respect to cost, and with there being other transaction types, not all of which I know, I was wondering if perhaps other solutions exist.  As for claiming that it is highly discouraged, I can only point out that this isn't factual.  I understand the problem with the UTXO set, and I have a legitimate use case, for which the only discouragement comes from cost, which will be paid for.  Perhaps using Lightning may be a solution, however, it isn't quite there for my use case.

Here is a post that explains transaction batching, which would be quite useful here.

Hi! Rather than linking to external articles, it is better to directly address the question in your own answer, or quote the relevant parts of the article you linked.


text:
How to earn Bitcoin without any investment
I have read about something that selling the computing power but I don't think it gives its value. Are there any more simple methods??

stealing???????

You need to create "wealth" for the community and community will make you rich. (http://paulgraham.com/wealth.html) Go code!

You always invest something (time for services, money for compute power, ...) when you want get something so the question does not make that much sense. "There is no free lunch."

If it is just for playing around, you might look for bitcoin faucets.
If it is for more, then you might look at "https://www.udemy.com/beginners-blueprint-for-earning-bitcoins-online/".
If it is for getting started, and you intend to contribute, look at the code, look at "bitcoin.org", and provide a service to the community :-)

As others have said, you always have to invest something, even if it is just your time, but there certainly are ways to earn bitcoin without any monetary investment.
Here are the 3 sites I use to get all the info I need for this exact question...
http://www.gr1innovations.com/how-to-make-money-with-bitcoin.html
http://earn-bitcoins.com
https://99bitcoins.com/how-to-earn-bitcoins-fast-free/
A lot of if is the same/similar on each one, but it's definitely some great ideas for earning bitcoins.


text:
Replay protection HF or SF?
I am naively under the impression that just about anything can be a soft fork nowadays, and that this is one of the benefits of Segwit.  Also, it seems that many claim in order for Bitcoin Core to implement replay protection, a hard fork is required.  This seems contradictory.  Perhaps someone could correct any of these assumptions?

Replay protection is only needed in the case of a Hard Fork.
To understand why this is true you should first understand what HF and SF are.
A great answer on the difference of Soft or Hard Fork can be found here


text:
what is the lowest amount i can transfer using bitcoin ? can i send 0 satoshis?
i was looking at this bitcoin tx
https://blockchain.info/tx/b4ea693a9d2d7e32b66777964fce13da302bed024bd9fd4651919da650fb1c40
where
Inputs and Outputs
Total Input 0.00003 BTC
Total Output    0 BTC
Fees    0.00003 BTC
Fee per byte    12.821 sat/B
Fee per weight unit 3.205 sat/WU
Estimated BTC Transacted    0 BTC

the user has set total output as 0 BTC so in short all input is given as fee.
Is this common practice or bug ?

This is unexpected (but valid) behavoiur of mining pool software. btw, i am creator of this tx

yes, 1aa... is my address

~16 millions in "hot" (memory-only) database. welcome to email

alistermaclin@mail.ru please

got it. please delete comment.s,

could you explain, why it is unexpected? Isn't the tx valid? Or what is it, what makes it invalid, but gone through?

tx is valid but non-standard. pools have a right to confirm non-standard txs but usually do not use their ability.

i tried broadcasting similar tx but received error as dust tx. so how could you broadcast it ?

rules are defined here:
https://en.bitcoin.it/wiki/Protocol_rules#.22tx.22_messages
it says "reject if the sum of input values < sum of output values", which is not the case. So a valid tx, where you spend all amounts to the miner...


text:
Why connected node count have dropped since august 1st?
before 1st august i used to connect to 55+ nodes on my bitcoin-core, even if i kept the bitcoin-core running for 12 hours.
but after 1st of august, the connected nodes count is not going above 15-23
why is that ?
what changed on august 1st ?
i  got that number when i do
bitcoin-cli getinfo

A common cause for a node's connection count going down and staying down for a while is IP address changes: It can take a while for knowledge of the new address to percolate in the network.
Otherwise, your prior high count could just have easily been caused by an attack or spy-peers that have since stopped.
It's a bit hard to say since the expected number of peers of a listening node depends on how many other peers are in the same /16.


text:
What does allowhighfees in sendrawtransaction actually does?
lets say.
i have created a raw transaction with inputs = outputs aka setting 0 fees.
so when i do
bitcoin-cli sendrawtransaction <signed_hex> 1

1 is for allowhighfees
what it actually does ?
if it increases fees ? then how much ?
how much fees does it sets per byte ?
What if there is not much satoshis in input to cover the fees ?

The fee is whatever you define in the raw transaction, based on the difference between inputs and outputs.  sendrawtransaction never changes it.  However, as a safety measure, it will normally reject your transaction if the fee exceeds a certain "absurd" threshold, so that you don't accidentally lose a lot of coins by miscalculating your raw transaction.  If you set the allowhighfees parameter, this check is disabled, and you can send a transaction with fees as high as you wish.
The threshold value can be set with the maxtxfee command line / config file option.

so its just precaution measure to not send all btc in fees.

Indeed, the only effect is possibly not creating a transaction instead of sending a transaction with enormous fee. It doesn't affect the fee of anything that'd be sent anyway.


text:
Does bitcoin-core software/client connects with only same version number nodes?
i am trying to connect to maximum number of nodes.
i noticed there are many receive version message in debug.log file
so i have question, does the bitcoin-core connects to only those having either same version number or in short range of version message of our bitcoin's version message ?
or does it connects to all and any nodes which completes the handshake ?

You can see from the Debug Window ("Peers" tab) that the Bitcoin Core client connects with multiple clients not only with different versions but different implementations.
So to answer your question: No.

thanks, i am using non gui version, so didnt noticed it.

The getpeerinfo RPC call will tell you the same thing.


text:
What happens when tx is broadcasted whose input is not yet received by mempool or are unknown?
lets say, there are 2 transactions
tx1
address1 -> address2

tx2
address2 -> address3

our mempool doesnt have the tx1 yet, but i try to create a tx2 and broadcast it.
what will happen ?
will tx2 get included in mempool ? and relayed to other nodes ?
or
tx2 gets rejected. and wont be included in mempool  and wont be relayed to other nodes ?
what is the actual flow ?
what are such tx are called ?
What happens when tx is broadcasted whose input is not yet received by mempool ?or not in the old blocks i.e. missing/unknown.

Such a transaction is called an orphan transaction.
When you announce a transaction to a peer who misses one or more of its inputs, the transaction will be placed in the orphan pool - where they are temporarily held in the hope that their dependencies arrive. A request will go out to fetch those dependencies from whoever sent us the transaction.
The transaction won't be relayed until it can be validated. Once all dependencies arrive, they will all be subject to normal validation and relay policies, and if acceptable, relayed in dependency order.

if i did the sendrawtransaction with such tx2, after getting it in our own mempool , who will  it send request for its dependencies ?


text:
How to make more than 1 nodes of mine connect each other?
Lets say i have 5 nodes running.
each node is on its dedicated server and is upto date. and its connected to available peers on the network.
How can i make them to connect each other and not to BAN them, and connect them again in case of bitcoind restarts ?
so in case i plan to make star topology of nodes and use central node for RPC connections.

You can add them to each other nodes bitcoin config file. If you want to connect to a specific node among others, use addnode=IP:PORT in your config. If you'd like to only connect to your own nodes and not other nodes on the network, you can use connect instead of addnode, but of course you should have at least one outgoing connection to get blocks, etc :)


text:
Any free bitcoind vps?
So let's say I'm developing a mining device that has some basic Ethernet or Wifi capabilities, but defiantly cannot run bitcoind. Let's also say that this device is open-source, so I cannot host a server for all of everyone. Is there some server somewhere that is running bitcoind that all of these devices could access (for free) or are there only paid options?

So you can't host a server for all of everyone, but you expect somebody else to offer that service for free? Seems unrealistic.

Well I didn't know if there was a good way to, lets say, access the raw info from blockchain.info

This is effectively what a mining pool does, right?  The pool operator runs bitcoind and serves the miners just the data that they need.  It's not exactly free, since the pool operator will take a cut of the mining revenue, but it is probably more like what you want.  Having direct access to a bitcoind is only useful if you want to solo mine, which is likely not what your customers want unless your device is remarkably powerful.

Thats true, ill probably find a pool


text:
Can a Non-Segwit Miner mine segwit transactions?
I understand that non-segwit nodes interpret segwit txes as Anyone-Can-Spend txes, and they cannot validate txes that spend segwit outputs.
But when an old style miner receives a segwit tx to mine he consideres it invalid, right? (That's because it appears to them as a strange transaction with no input and 1 output.)
So, does it follow that segwit txes can only be mined in a block by upgraded miners?

Yes, only segwit nodes can mine valid blocks with segwit transactions.
A non-segwit node cannot process complete segwit transactions. The segwit transaction serialization format puts two new fields in the transaction header, the marker and the flag. The marker indicates that the transaction uses the extended serialization format. The marker is a 0x00 and appears after the version field in the serialization. A non-segwit node would expect the input count in that position of the serialization. Since a transaction is invalid if it has zero inputs, a non-segwit node would discard a segwit transaction due to interpreting the marker as the input count and therefore considering the transaction invalid.
However, a non-segwit node will never see a complete segwit transaction. Segwit nodes use a new peer-to-peer message to request transactions with witness data. When a non-segwit node requests a transaction, they use the original message. This tells their peer that they are asking for the original serialization format. Their peer will then strip the witness data from the transaction and give them only a stripped transaction, i.e. a transaction from which all witness data has been removed. This stripped transaction is valid, but non-standard to the non-segwit node, because one element remains on the stack after resolving the input script.
By default, nodes will not accept non-standard transactions into their mempool. Nodes only relay what they accept into their mempool, and miners build blocks from the content of their mempool. This means that an unconfirmed stripped transaction would neither relay among non-segwit nodes, nor would a non-segwit miner attempt to include a stripped transaction into their block. Further, segwit nodes will not announce segwit transactions to non-segwit nodes. However, non-segwit nodes will accept a stripped transaction in a block because it is valid. Since stripped transactions identify which UTXOs are spent and include all new outputs completely, non-segwit nodes arrive at the same UTXO set by processing the (stripped) blocks. As part of the (stripped) block, the stripped transaction will be relayed even among non-segwit nodes.
When a block includes segwit transactions, the coinbase transaction is required to have an OP_RETURN output that contains the witness commitment. This witness commitment is the Merkle root of the witness transaction ids (WTXIDs) of all transactions in the block. If a non-segwit miner were to modify their node to accept stripped transactions into their mempool and mine blocks including them, they would trip themselves up: they cannot actually validate a segwit transaction completely, because they don’t have the witness data. This would enable another network participant to give them a stripped transaction for which no witness data exists and they’d take it. Further, even if the transaction was valid and a complete version exists, without the witness data they cannot construct the witness commitment and any segwit nodes (98%+ of the nodes on the network) would reject a block without the witness commitment when it contains segwit transactions. Non-segwit miners can continue to mine blocks that only include non-segwit transactions. Between the choice of a rejected block, or a block subsidy and the fees for non-segwit transactions, a non-segwit miner would be better off to mine only non-segwit transactions.
In conclusion, only a segwit-enabled node can create a valid block that includes segwit transactions, but a non-upgraded miner would continue to mine non-segwit nodes without ever seeing unconfirmed segwit transactions.

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
How to delete my BlockChain.info account?
Is there any way to delete a BlockChain.info account? I am not able to find any such option in settings.

Is this on blockchain.info? If yes I suggest you contact the site's support.

No, there's no way. But you can vote on https://blockchain.uservoice.com/forums/152743-general-ideas/suggestions/2651836-option-to-delete-account


text:
How to generate bitcoin P2SH WIF key and address pair from sha256 private key?
lets say i have sha256 Private Key Hexadecimal Format
0000000000000000000000000000000000000000000000000000000000000001

how can i get P2SH address and its corresponding WIF private KEY ?
by P2SH i mean P2SH-P2WPKH address starting with 3.
are these called 1-of-1 multisig address ?

Private keys give public keys, which can give bitcoin addresses starting with a 1. But a P2SH address (starting with a 3) is simply the hash of a script, and that script could be almost anything, it isn't usually associated with a single public/private key. Perhaps you mean P2SH-P2WPKH? In that case you could read something like this: https://bitcoincore.org/en/segwit_wallet_dev/ (specifically the section called 'Creation of P2SH-P2WPKH Address'). Otherwise maybe something like a 1-of-1 multisig address or simple P2SH encoding a normal P2PK/P2PKH redeem script? I'll update this answer if you clarify exactly what you mean :)

1-of-1 multisig address.

Please update your answer on how to compute the P2SH address (starting with a 3) from scriptPubKey.

@Jus12 that is not what the question asked. If you have a new question, please ask it separately :)

It's the same b58check(HASH160), but you're hashing a script.
The script for 1-to-1 multisig P2SH addresses is OP_0 hash160(pubkey).
So your address would be b58check(hash160('\x00\x14' + hash160(pubkey))).
Long story short:
1) WIF to pubkey:

secret = b58check_decode(WIF)
pubkey = ECKey(secret).pubkey

2) pubkey to P2PKH (legacy address):

addrtype = 0
addr = b58check(addrtype, hash160(pubkey))

3) pubkey to P2SH (1-to-1 multisig address):

addrtype = 5
addr = b58check(addrtype, hash160('\x00\x14' + hash160(pubkey)))

where hash160(x) = ripemd160(sha256(x))

That's, basically, it. Also see https://github.com/joric/pywallet/issues/1
Regarding 32-byte secret to WIF conversion - bitcoin core doesn't tell apart different WIF's it's just b58check(secret) type 0x80. Importprivkey command generates 3 different addresses - P2PKH, P2SH and BECH32 from the same secret, and you can reexport-reimport the secret anytime.

if "\x00" means OP_0, what does the "\x14" mean?

next to bitcoin.org, adresses are structured this way: https://en.bitcoin.it/wiki/Protocol_specification#Addresses
and a detailed step-by-step explanation: https://en.bitcoin.it/wiki/Technical_background_of_version_1_Bitcoin_addresses
This allowed me to understand more detailed: http://www.righto.com/2014/02/bitcoins-hard-way-using-raw-bitcoin.html
I usually use this site to verify results: http://gobittest.appspot.com/Address

ooops, forgot the bitcoin bible:-) http://chimera.labs.oreilly.com/books/1234000001802/ch04.html#private_public_keys

oh, so it is P2SH and multisig: this would be the starting point:  http://www.soroushjp.com/2014/12/20/bitcoin-multisig-the-hard-way-understanding-raw-multisignature-bitcoin-transactions/


text:
Blockchain as a solution for software licensing?
I'm curious as to what blockchain could do to solve or improve upon the issues surrounding paid software licensing? (Verification, piracy prevention)
I've seen such claims all over the web when there is discussion around which domains blockchain has the potential to innovate.
I'm very interested in this if it is true but I cannot think of any tangible benefits opposed to a traditional license server (i.e. user has to verify their license key by checking against your server)
I suppose one benefit could simply be that it gives you the benefit of a license server without having to actually have a server, the blockchain would verify the validity of licenses.
Other than this, what else could blockchain do? Piracy would still be an issue, nothing will prevent me from lending my license  ( say , my private key) to my friend.
Also another problematic issue is what incentive will there be for miners?
All of the hype made me very optimistic but I can't find anything to back up these claims.

They could but the best implementations of new tech are when they solve a problem in a new way. What problem would this solve?

I stated it in the question. I've seen claims from blockchain evangelists that it can solve this problem. I can never find any justifications and can't think of any. I'm hoping to seek clarity here. The answer may in fact be that blockchain is not suitable for the task.

The following are just some ideas that came to my mind when reading your question:
Let's say that all the instances of the software you want to protect share a blockchain with the servers of the producer company.
Licenses are released through the blockchain as a transaction, with the user who purchased the license as the receiver. This user, who will have its own private key (let's say a password), will be the only one able to unlock the license.
Each copy of the software program will also be registered on the blockchain (as an integrity checksum), so to uniquely associate the license to that specific copy.
The "license" transaction contain all the data that need to be verified, including:

the "coin" representing one license (maybe more than one)
the user ID (public key)
the the software copy ID/IDs (embedded in the software image)
a timestamp for the beginning of the license validity
the expiration time / date

Alternatively to the user ID, a unique identifier of the machine that will be allowed to run the code can be stored (e.g. the CPU ID, or something stored in a non-writable memory, so that it cannot be modified; this data can be sent by the user along with a "purchase transaction" on the same blockchain).
Now, the protected software connects to the blockchain each time it runs, to verify it can be actually run on that computer: if all the conditions written in the license transaction are valid, it runs the program, otherwise it stops.
Since data store in the blockchain cannot be modified, this prevents tampering.
The software copy ID can be an integrity checksum of the program image that is also stored on the blockchain; so if someone tries to crack it, the software will not recognize itself because the new checksum is not stored on the blockchain (only the transactions signed by the producer will be valid).
In case of software updates, new checksums can again be released through the blockchain (by the producer).
So, these were just a couple of ideas, but it's my belief that it wouldn't be hard to think about more and more sophisticated techniques.
In conclusion, let me point out that what we are actually talking about here, is a special case of the so called "smart contracts".
Hope this helps

In your model, what mechanism will prevent modificaitons on the blockchain? Would there be miners?

Also, it makes sense to have a checksum of the software on the blockchain to prevent cracking, along with using some hardware ID as identification. But what protection is there from simply intercepting request before it goes to the internet and replacing identifier with someone else's license? (e.g. my friend's private+public key who is sharing with me). There would need to be some encryption done inside of the (unmodified) client app. But encrypted data does not make sense with a public distributed blockchain...

Question 1: it depends on the consensus mechanism you want to adopt. with Proof of Work you will need miners, but others work in a different way (e.g. see Proof of Stake). In case of PoW, you can think of a blockchain shared by all different software houses (and their clients), giving some kind of reward to miners (e.g. free licences? or a "licence coin" to be used to purchase licences). I think this question is open to many answers.

Question 2: I can't understand your question... but:

transactions are signed with your privkey, so an attacker can't tamper with your tx without it

who said that encryption doesn't make sense in public blockchains? transactions must be public, but you can insert encrypted data in it (even on Bitcoin this is possible)

Why would a blockchain be needed here? Can't this whole thing already happen in a centralized way? Also, I feel like whatever way hackers currently use for centralized license would work here as well.

I think the biggest benefit of having licenses stored on the blockchain compared to a licensing server would be, that these licenses would be independent from the issuing companies. So, if the company's license server can not be accessed anymore, you would be still able to activate your software. This could - at least in theory - happen, if the company closes, decides or is forced to stop the support. There could be also political reasons like internet filtering or that the software is declared as illegal to use in some countries. - Also, an "open" system like this would keep companies from switching around between different license managers.
Generally, it would be really cool, to have a digital identity, where you can just add the licenses to it, independent from operating systems and just activate it on the computer you are currently working on. People like me, who are switching between Mac, Windows and Linux all the time, would appreciate this.

Today's licensing systems, in general, are using the same paradigm that is now over 30 years old.  License an entity in a static environment for a static amount of time.
The problem is that today's paradigm is not static.
There are actually 3 components required for management of an asset and ensuring vendor and customer receive value for value.  The Contract (what can be used and under what terms), the Purchase Order (Customer's request to use an asset) and the license (what is actually used, in what way).  Each of these is dynamic and can affect the view of the vendor and customer on what $$ should change hands for what period of time.   Since anyone of the above can change at any time it is extremely difficult to keep track of the who using what, when and where and what the vendor has agreed to supply.  Using a BC enables these 3 factors to be measured, managed and checked at anytime and since the BC keeps a running record of all changes overtime either party can verify independently of the other exactly what is in use and what is to be paid for.
Using BC to Manage and Monitor assets enables both sides to see at any point in time exactly where they are and what is in use vs not in use.  Otherwise, you have to read a contract, examine a PO and get a report of the usage and then compare each and since not all information is a available to all parties readily there must be negotiations to settle any differences.  BC eliminates this entire mess and makes everything transparent.

A typical how-to can be as the following (we are doing so on the ethereum):
1) Generate and sell tokens (maybe in a crowdsale).
2) Create a wallet (or maybe use an existing one) - The idea is to check for a predefined amount of the token in the wallet.
Doing so, the concept of a valid license can be as simple as having some of that tokens in the wallet and check the wallet for that. You can also perform more advanced or complex licensing rules the same way.


text:
What is AuroraMine?
I'm a teaching assistant for a 2nd year undergrad computer science course, and one of my students started talking to me about bitcoin (which I personally detest, but admittedly know nothing about), and he showed me this idea of "mining bitcoin".
He was using this site called AuroraMine, which, as he explained it to me, will mine bitcoin for the trade-off of running background processes on your computer. (You pay them, and they pay you if your generated key/hash breaks open a bitcoin block...or something like that.)
Now, how on earth is this any different than botting? I'm deeply concerned he fell for a scam, and his computer is simply being botted for malicious intent (e.g. hacking encryption keys, DDOS attacks, etc.) In fact, the breaking of an encryption key is not very far from the analogy of breaking open a "bitcoin block" with a "hash", or whatever.
So, does anyone know what this stuff actually is? Is it at the bare minimum, not malicious?  Thank you, all.

AuroraMine doesn't seem to mention anything about running anything on your computer, where did you hear that? You just pay them and they mine

He was using this site called AuroraMine, which, as he explained it to me, will mine bitcoin for the trade-off of running background processes on your computer.

That does not seem right. The website that you linked to does not have anywhere to download any software. It looks like to be a cloud mining service where you essentially rent hash rate to mine Bitcoin. However the vast majority of these services are scams (many are just ponzi schemes) or simply unprofitable (why would the owners be renting their hardware away if they could be making more by just mining with their hardware for themselves).

Now, how on earth is this any different than botting? I'm deeply concerned he fell for a scam, and his computer is simply being botted for malicious intent (e.g. hacking encryption keys, DDOS attacks, etc.)

Your student himself might have fallen for a scam, but Bitcoin mining in general is very different from botting and is not malicious.

In fact, the breaking of an encryption key is not very far from the analogy of breaking open a "bitcoin block" with a "hash", or whatever.

That's just completely wrong and not at all how Bitcoin mining works.

After speaking with the student again, he confirmed to me that he actually knew it was a scam already. The thing is, he joined very early in its making, so he's at the top of the scheme (whatever works for him, I suppose..) I appreciate your answer, thank you!

Auroramine is no scam at all. Its has continued to pay out since is started. Over 400k members can't be wrong. Its also an registered company in UK, USA, Iceland etc instead of doubting it maybe give it a try first.


text:
Which is the best LN software?
I know that software for the Lightning Network can only be used with testnet and not with real Bitcoin yet.
I'm trying to choose one LN software among C-Lightning, ACINQ, AmikoPay, Thunder, Lit and Lnd in order to study and test it. What are the main differences between them?
Thank you!

Obivously, the question and this answer are subjective based on personal experiences. I've only used LND and C-Lightning, which are arguably the most popular. The following is a summary of my experiences:
LND
LND is built in GO and requires a special version of Bitcoin built in GO as well. The install process is well documented and pretty straightforward. However, I had issues with configuring Glide, which is required to install the dependencies. Additionally, I was hesitant to rely on the GO version of Bitcoin to stay supported. Supposedly, there's a pull request to make the changes needed in the Core version, but still... I considered it a risk. Once past the dependency issues, LND worked great. I would have continued using it, but I wanted to try other implementations.
C-Lightning
Since I run Core's version of Bitcoin and prefer my daemons to be in C (again, an objective position based on personal experiences), I tried C-Lightning next. There weren't any issues with installation on Ubuntu and it's been purring along since. The only problems I've had are around documentation, which I'd say LND has done a slightly better job with so far.

In summary, the above Lightning implementations are great and I would recommend either. Both have fantastic teams behind them and are consistently committing updates.
I ended up sticking with C-Lightning because it had the architecture and dependencies I'm most comfortable with and have the most experience with (Bitcoin Core and C). Since both implementations are still a work in progress and documentation is ongoing, I find myself continuously in the code figuring out errors and options. If I was more of a GO developer, I'd probably choose LND.


text:
electrum wallet: is recognizing the seed a problem?
I understand if you find someones seed, you get hold of the contents of the wallet correct?
If so, the fact that the seed is a list of 13 words, is not a risk regarding being recognized by anyone that get holds of that list?
I mean, if you keep some text file with a bunch of passwords, but without too much info on what places the passwords are for, the passwords might not be too useful to the person getting them. But if there is a list of 13 words, a list that can be see it matches a subset of the electrum seed list, is that not a risk? someone could realize quickly that is a electrum wallet seed...
I guess there are ways to improve this, like storing just the position of the words etc, but still.

I guess there are ways to improve this, like storing just the position of the words etc, but still

Well, don't store it in a place where someone else can find it. No matter what. Not even inside a bigger list of text to obfuscate it. It is trivial to verify which combinations of words might be a valid seed.

I'm not sure I understand your last sentence. I'm not at expert at all in this but I guess that since the words used in the seeds is a very specific list it wouldn't be hard to imagine some program parsing your text file looking for a subset of these set of words in the list and guessing that this is a seed for your wallet :/. Remember that there is potential malware, hackers or even some "friend" threating to steal your bitcoins.
Definitely it would be much safer if you just write your seed in a piece of paper and store it very safely.


text:
How proof of work prevents double spend
One article I am reading said that proof of work system is used in Bitcoin to prevent double spending. More particularly:
Imagine we are protecting against double spending in following way. When Bob receives transaction from Alice saying that "Alice transfers some 1234 BTC to Bob", bob would broadcast this to entire network to ask them to verify whether this is a legitimate transaction. In the mean time say if Alice had sent also same message to Charlie (saying that she is transfering same 1234 BTC to Charlie), Charlie would have also broadcast this message and other nodes on the network would spot that Alice is trying to spend same 1234 BTC with two persons, and they would let Bob (or Charlie) know that this is invalid transaction. Or if all is ok Bob or Charlie would wait till some nodes send acknowledgment that this is valid transaction.
SOCK PUPPET ATTACK: Above scheme would work but Alice could cheat in the following way. She could create say one million fake identities on network, and they would lie to Bob and Charlie that the transactions was valid- making them accept payment.
Now comes my question. It seems proof of work was introduced in Bitcoin to prevent exactly the above kind of sock poppet attack. But I fail to see how proof of work helps protect against above sock puppet attack. Why would Alice not be able to introduce those fake 100000 identities on the network anymore?
Can someone ealaborate and explain?
ps. I know what proof of work is, this question is more related how and why it prevents above mentioned sock puppet attack.

It is not really the Proof of Work which prevents double spends but rather the blockchain itself which prevents double spends. The Proof of Work is just one aspect of the blockchain.
For a transaction to be considered final, it must be in the blockchain. Otherwise it could disappear forever and everyone forgets about it. For a transaction to be added to the blockchain, it must be included in a block, and miners will do a Proof of Work for the block. In order for the transaction to be included in a block, the outputs that it spends from must have not been spent by any other transaction in the blockchain nor by any other transaction in the block. If such an other transaction exists in the blockchain, then the block will be invalid.
It is this process of including transactions in blocks which avoids double spends. It essentially establishes an order and says "this transaction is the real transaction, all others which spends any of the outputs which this transaction spends are fake".
The proof of work mechanism exists in Bitcoin because that is what makes the blockchain immutable. A valid proof of work means that a miner is proving that they did a certain amount of work, on average, in order to produce a block. In order to replace that block, someone else must also do about the same amount of work for that block. If someone wanted to modify a block in the blockchain and have everyone accept it, that person must perform the same amount of work that went into creating the block, then do the same for every single block that follows it because those blocks would be invalid since a block in their history has changed. This makes the blockchain immutable; the amount of work required to rewrite history is considered to be infeasible and much too costly to do practically. That is what the Proof of Work is for.

you may want to read the question once again. Only block chain would not suffice. All nodes have blockchain locally. So as in question if alice simultaneously sends same transaction to bob and charlie in both users' blockchain it would seem that the transaction is valid (because that coin has not been spent yet). So you need a consesus protocol where bob and charlie would ask for example whole network if the transaction they receive is OK. but there comes the sock puppet attack I mentioned.

That's not how the blockchain works. The blockchain is the consensus protocol where Bob and Charlie asks the network whether the transaction they receive is ok. The blockchain is not something that is added to locally when new transactions are received. It is added to locally when new blocks are received, and new blocks can only be created by performing the proof of work. Blocks and transactions must also conform to the consensus rules that the node is following. Those rules also include double spend protection.

Here is article I referred to: http://www.michaelnielsen.org/ddi/how-the-bitcoin-protocol-actually-works/. Section "proof of work"

And besides can you then explain (maybe in answer) WHY proof of work was added to bitcoin? what purpose does it serve?

I have updated my answer

Does it mean that the node have to search through all the blocks in the block chain (up until the generation of the output that it spends from) to confirm that the outputs that it spends from  have not been spent by any other transaction in the blockchain?

@qianfg Yes, but there are smarter ways to do that than actually searching through the blockchain for every transaction.

@AndrewChow You did not answer the question how the attack is blocked.

Thank you for that clear answer. You were saying that proof of work exists to make it computationally infeasible to consider modifying a transaction, and thereby also financially infeasible. But if let's say there was a transaction for $10 million In the most recent block, would it not be potentially profitable for someone to go and modify that block?

@N.S. It could be profitable, but a mine would have to act quickly and be lucky. If more blocks are built on top, it becomes exponentially harder and thus more expensive to perform a reorg.

For a transaction to be valid it is not enough to be broadcasted by the attacker or repeated by many nodes. It must be added to the blockchain by some node in the network. Adding the transaction to the blockchain is not easy, as some node in the network must make PoW, which is time and processing power consuming.
Inside single chain transactions cannot collide. Each node accepts longest chain as valid one so for an attack to succede the attacker must maintain two equally long chains. Then some nodes will accept one chain and others other chain as valid, thus allowing an attacker to spend money twice - within one transaction on one chain and other 'colliding' transaction on other chain.
If attacker has 10% of total nodes in the network (by processing power) he is unlikely to maintain 2 such chains and put wanted different transactions in each as the majority of nodes (honest 90%) will outpace him with their own chain. Thus there will exist (in long term: 2, 3  or more blocks) only one chain. As said, inside single chain transactions cannot colide, thus you cannot double spend.

If we could assume that the majority of nodes are honest (i.e. following rules), we could use less wasteful rules (i.e. without proof-of-work) for creating a new block.

The Sock Puppet reference
Why would Alice not be able to introduce those fake 100000 identities on the network anymore?
Impersonation, ID-faking of the nodes/miners based on IP spoofing is "difficult" in Blockchain as it involves Proof of Work/Hash Guessing problem to be solved first before a node can broadcast a (rogue?) message to the network. Since the amount of computation required (do Hash Guessing) to send rogue messages is so high, it becomes impractical to do 1M impersonation requests.
She could create say one million fake identities on network...
One can steal private keys of other nodes to create transactions on their behalf, but still it would follow Blockchain consensus principles. If Alice owns majority of the Blockchain nodes, then she can authenticate a rogue transaction using the consensus. This is commonly referred as 51% attack, Sybil attack.
Faking identities is quite difficult and the scenarios why it will eventually fail has been explained in croraf's answer.


text:
What prevents a node from sending a different version of the blockchain?
I understand that proof of work prevents a node from creating a new version of the blockchain unless they have >50% of the hash rate, but what if the attacker is also able to intercept the victim's internet traffic?
In that case, it would be able to mine a few blocks (or if that's too difficult, start a new blockchain from the genesis block) and then replace traffic to any node on the network with traffic to their fake node with a different version of the blockchain. The victim would then not know that a longer chain exists, so would believe the attacker.
What prevents someone from doing this?

In the scenario you describe, in which the only peers a bitcoin core node can connect to are owned by an attacker or colluding attackers, there is a minimum-chain-work-required for the block headers, so the client will not accept a chain which has a total amount of work less than the amount hardcoded into it here. There may be more forms of protection too, my knowledge is incomplete, but that at least provide a lot against such a situation. The node performs headers-first-sync which means it will know what the work of the chain is before it spends a lot more bandwidth and processing power validating the blocks themselves.


text:
Can I claim my bitcoin gold if I have used my bitcoins few days ago?
I had my bitcoins on blockchain.info when the fork happened. A few days ago I sold my bitcoins. Now I am wondering if there is a way I can claim my bitcoin gold? Blockchain.info support has said I can export my private keys and get them but I have no idea on how to do it. Please guide. Thanks.

You should be able to claim your Bitcoin Gold with your private key. The snapshot of ownership for Bitcoin Gold was taken on October 25th, if you had bitcoins at that time, you'll get Bitcoin Gold.
In order to redeem it, you'll need to import your seed/private key in a Bitcoin Gold wallet, but beware of fake wallets that just want to steal your coins.


text:
What subjects do I need to study before I am capable of understanding the mathematical problem being solved in Bitcoin mining?
I am a post graduate electrical engineering student, specialising in digital electronics. I would like to foray into ASICs for bitcoin mining. But first I need to understand the mathematics of Bitcoin mining. What subjects do I need to study to get a good idea of what my ASIC has to tackle?

Your ASIC basically only does one thing: SHA256 hashing. It gets a block template, hashes it, compares the result as if it was a number to some target to see if it is less than the target, if not it modifies the block slightly, hashes again, repeat...
So all you need to understand is the SHA-256 hash algorithm. It is not overly complicated, you will need to understand some logical bitwise operations like AND and XOR, hopefully understand how bits, bytes, hexadecimal, etc. are all related, it involves some bit-rotations which should be mostly self-explanatory, how modulo works, and maybe a couple of other similar-level concepts. As a postgrad digital electronics engineer I expect most of these concepts are bread and butter to you, so you should be ok :)
Of course, that's just to read through how the algorithm works, understanding why certain things are done in the algorithm is much more complicated and would require a lot more reading about hash functions and cryptography. But understanding why something is done is not a requirement to use it.
Wikipedia page for SHA-256 which contains some pseudocode is found here: https://en.wikipedia.org/wiki/SHA-2


text:
What happens an order and offer are matched but there is a significant gap between them?
I wonder the implications of the following scenario.
Let's assume I offered one coin with the price 1k (by mistake or for experiment), while the highest order in the market is 2k. What are the prices I'm going to pay and the matching order is going to receive. How would this affect the current price of the market? Thanks

It depends on the exchange; they will have rules for how order matching is handled.
On at least one of the exchanges I have used, if there existed a buy order for 1 coin for $2000 and you added a sell order with a $1000 limit, then you would get $2000. If however, the buy order at $2000 was only for 0.6 coins then you would sell 0.6 coins at $2000 and the remainder of your sell order (0.4 coins) would be matched by the next highest buy order, eg $1950, provided that another buy order existed at or over $1000.
I would expect this behaviour to be more common amongst exchanges that what @chytrik described in his answer.

Do you know of any exchanges where this rule is not followed? I don't.  AFAIK it's the standard rule for exchanges of all kinds (coins, stock, commodities, etc).

@NateEldredge No, but I haven't looked extensively either.