How are transactions verified to ensure only the eligible person can spend a Bitcoin balance? I know each user has a public key and private key. The users signs the transaction with his private key and sends it to a Bitcoin address. What prevents me from claiming his coins? I read something about verification with the private key but I didn't really understand. How does Bitcoin ensure that only the eligible person can spend the bitcoin? More specifically I didn't understand the verify and sign part in Satoshi's paper in the diagram on page 2.

Also from this diagram, how is it that a secret key can act as a key to lock a lock, but the public key can open the lock only but can't lock it back? How is this implemented technically?

Read about Public-key cryptography and Digital signature.

For bitcoins you need the private key to spend (by signing) the coins that were "sent" to the address associated with a public key.


How many transactions are there in one block What I understand:
When a transaction is made , miners compete to  validate it and create a hash . If one miner creates the hash and more than 51% of miners agree on the validity .Then the a block is added to the blockchain.
Am I right?
My doubt:
1)When a block is added it contains one transaction that is validated or more?
Thanks.

When a transaction is made, miners compete to validate it and create a hash.

Miners will compete to confirm the transaction in a block. 'Validation' of a transaction is completed by each and every full node on the network. Notice the difference between confirmation and validation:
Validation checks to see if the transaction is valid according to the network rules.
Confirmation involves having a valid transaction included in a block that is a part of the longest (most-work) chain.

If one miner creates the hash and more than 51% of miners agree on the validity.

As with transactions, a block is either valid, or invalid, and this fact does not depend on what other miners have decided. Full nodes perform this validity check, while miners just keep adding more blocks to the chain.

)When a block is added it contains one transaction that is validated or more?

Miners can choose whichever valid transactions they would like to include, up to the 'weight limit' of 4,000 kilo-weight-units. In practice, this generally means the block can be anywhere from a few hundred bytes, to 4 MB. These transactions are chosen prior to finding the valid hash, which means that once a valid block has been found, the transactional content of that block is locked in; the miner cannot add or remove transactions without invalidating the block.


How to determine if a BTC payment has been done Scenario: You have a website running on a remote server, and you want to accept BTC donations to a specific address (most likely yours) and to display a "Thank you" message automatically.

How do you determine programmatically if a payment to said address happened? Is it even possible?

Using bitcoind in this case is not possible because the Bitcoin wallet is not on the server, so what could one use? blockchain.info's API?

Thanks!

blockchain.info does work to monitor the blockchain. Here's a couple of other ideas...

If the wallet server is connected to the internet, have it monitor the address (perhaps using the -walletnotify option) and then create a message queue (e.g. amazon sqs). When a wallet transaction happens PUSH the relevant info into the message queue. The web server then monitors the message queue, POPs the message and takes appropriate steps.
You can also look into the Watch Only pull request for bitcoind. This pull request has not been incorporated into the main bitcoind, but you could compile it into your own modified version. You then would need to add the public address to the Watch Only wallet. This modified version of bitcoind could then reside on your web server without the fear of compromising private keys.

Cheers!


Restore backup wallet In the app "Bitcoin wallet" from " bitcoin wallet developers" you can choose to backup your wallet. It will store this backup on your sd-card. But how can you restore it on another phone? I saved the backup on my PC and send it to my other phone, but he can't open the file and I don't know how to restore the wallet.

you have in the wallet on the right top the 3 points. click on it. click on "security" (or something like that, on my phone the language is not english). in my case i have several options including "save wallet" and "restore wallet" (or something like that). when you click the restore-option you should be able to choose your backup if the app finds your backup (in my case it finds my test-backup in the downloadfolder on the sd-card for example).


The result of bitcoin-cli getpeerinfo command When I type bitcoin-cli getpeerinfo in shell, conspicuous property of the result are addr and addrlocal addrbind.

14.xx is my address and others are peer's address.
I know that Bitcoin client can do port forwarding using UPnP query to my router.
so, I checked my router whether the port number(48302, 44660) is opened or not but, no any port is currently open.
This is very strange point. my peers should cannot communicate with me without port forwarding since I'm using router.

Can you give information technically?

Sorry for my English

so, I checked my router whether the port number(48302, 44660) is opened or not but, no any port is currently open.

They don't appear open because those ports are not always open listening for incoming connections. Rather those ports are bound to temporarily by the forwarding software which then initiates the connection to your computer. As soon as the connection to the peer closes, so will that port.

What you see with that is like the ports that your browser uses to connect to remote web servers. When you have your browser open, a port is opened. But if you port scan your own computer, you won't see those ports. You can see what ports are active and connected to other servers by using the netstat -nap command.


Does Bitcoin have a legal expert/team that does their work? Does Bitcoin have a legal expert/team that does their work? (yes, they - a group of interested individuals (the Bitcoin team) even though they have no formal association - are a decentralized network but some of those decentralized networks do have offices, etc., and may have a legal team.)

Are there any private individuals who have (ever) started an action on behalf of Bitcoin?

BITCOIN is a software ecosystem, and not owned by "someone". Similiarily you could put some code [echo "hello world"] on github, and it would be publicly available. Then there is also no "they", or an association managing the code. The bitcoin developpers are a group of loosely coupled "geeks/freaks", and anyone with a good skill set could belong to this group, by participating in coding/translating websides/correcting wording ... For sure you know that. So as this developer team provides (a highly sophisticated) software, they are not dealing with regulations from each country, in which the software could be used. But I think your point goes into this direction:

There are companies using this public domain ecosystem (kraken, bitfinex, hitbtc, bitcoin.de, blockchain.info). These companies (and some miners) provide ramp-ups and -downs, to make it easy for you and me to use the bitcoin eco-system. They are for sure under a jurisdiction, within their appropriate countries. And for sure "they" have legal/compliance teams, that deal with country specific regulations (aka "KYC/KYI/...").

Still I am not clear on what you suppose by "their work". I think it would be fair to say, Bitcoin doesn't need any work at the legal level. Countries and governments (or other power structures over individuals) need such things, so it is up to "them" (these power structures), to make sure, bitcoin is used in a way, that it complies with their rules of keeping tidal waves of change away from their protected environment :-)


Wallet on multiple computers I have a desktop, laptop, tablet, and phone.  I want to be able to send and receive payments from all these devices.

How do I go about doing that?  Do I have to create a unique wallet on each computer?

Copying the same wallet.dat to two different computers will initially seem to work, but if you continue to use bitcoin-qt to send bitcoin, the two copies will get out of sync.

The reason for this is the automatic use of "change" addresses. Each time you send an amount less than you originally received, there is "change" that must be returned to you.  The developers of bitcoin-qt considered this to be a privacy weakness, as it would make it easier to tell for sure how much was paid and to whom.  To make it more private, they generate a new random "change" address in your wallet and send back your change to that new address.  To a third party looking at the block chain, it is hard to tell who holds the change address or who was the actual recipient of the transaction.

The reality is that the use of change addresses does little to improve privacy, but sets up new users for a "big surprise" the first time they send a small amount and see their wallet balance temporarily go to zero prior to confirmation of the change. It also makes it unsafe to copy the same wallet to multiple computers.

There are other wallets that give the user control over use of change addresses and that also make the change addresses visible and therefore more understandable.

Another area where other wallets can help is in the generation of new addresses.  The original bitcoin-qt wallet generates new addresses randomly.  It tries to keep a pool of pre-generated addresses, so that if you copy a wallet it will seem to generate the same new addresses as the original, but eventually the pool of keys will be used up and after that the two copies of the wallet will start to have different contents.  The Electrum guys solved this by making the whole wallet "deterministic".  That means that all future keys are determined completely by the "seed" and are not truly random.  Because of this, you can restore the same wallet on multiple machines and all copies will forever remain in sync.

There are plans to add this sort of functionality to the main bitcoin-qt wallet, but until that is done, alternate wallets are needed if you want to share between computers. Electrum is not the only wallet that provides all these features, but it is the one I am most familiar with.  See electrum.org.


Bitcoin-Qt client wallet.dat extract private key to import on another service I have a file: wallet.dat where should be saved one or more private keys of my old wallet linked to one/more public btc addresses. I also had more than a wallet, so I don't really know if there are some created address with an amount of money in that file or not. Of course, I don't want to download 500 gbs of transactions since 2009 using Qt-Coin and my idea was to extract private keys in order to import them on another wallet like blockchain.com.
I managed to use some open source tool (wt_extract_keys.py https://github.com/akx/walletool) to extract private keys, one seemed to work but the format of private keys seems to be not compatible because blockchain.com requires a private key in a wif format and what I got is a very big private non-compressed key.
So how can I get the private key/s with the right format this if it's possible? What do you suggest?

I would use the dumpwallet approach using Core, then use a script to remove everything but the WIF private keys and import them to Electrum which can import a list of private keys


How many possible addresses per bitcoin private key? Based on my research every bitcoin private key (compressed or uncompressed) can have 4 different addresses:

P2PKH compressed and starts with 1
P2PKH uncompressed and starts with 1
P2SH and starts with 3
Bech32 and starts with bc1

Are there any other types of address that can be created from a private key?

It depends a lot on the kind of locking condition you want to satisfy. The addresses that you have mentioned would depict 'standard' locking condition where the user reveals their public key and associated signature in order to spend the locked bitcoins. However, you can create custom scripts and then convert them into standard addresses.

For example, locking some bitcoins in a CLTV script using the same private key will generate a completely different address. You can use CSV or any other custom opcodes like OP_ADD to generate those custom scripts and then wrap the script in P2SH or P2WSH. When you spend the funds you need to reveal the custom script and the signatures should match. When you include the possibility of generating standard addresses from the custom made script, the possibilities are endless.

Also, a point to note is that a compressed public key will generate a completely different address as compared to an uncompressed public key.


Is Block Height 1 is the genesis block? As the question I asked before, I wanted to make an altcoin. The block height in main.cpp allows you to choose which block gets different rewards. If it does, do txNew.vout[0].nValue =  depend on the first block or the normal block reward

The genesis block has height 0 (at least in the Bitcoin reference client source code).


How to quickly find the private key from Segwit P2SH address? I have a very large list of Segwit addresses for bitcoin, starting with '3' and do not know the corresponding legacy '1' address for them.

How can I quickly find the corresponding legacy address to export the private key from Bitcoin Core?

The Seqwit addresses have not received any transactions, yet.

I think I will need a script, or a program maybe...

[this is an issue with LTC having been sent to a segwit address generated using Bitcoin Core]

How to quickly find the private key from Segwit P2SH address?

As per today, it is impossible to find the private key from any public key or address. Also from a SegWit P2SH address. There is always hashing involved, which is a one way function.

I think you maybe wanted to ask, how to come to the public addresses (see below), so that you can extract corresponding priv key from bitcoin wallet...

I think there is no quick way :-(

But with some programming and web page links, this might get you to your goal:

  I have a very large list of Segwit addresses for bitcoin, starting
  with '3' and do not know the corresponding legacy '1' address for
  them.

The way the type 3 addresses are composed includes once again a hash value, so you cannot easily "go back" - it is a one way function. The way how they are composed is described here, and here is a description in bitcointalk forum.

  How can I quickly find the corresponding legacy address to export the
  private key from Bitcoin Core?
  The Seqwit addresses have not received any transactions, yet.

And here it gets difficult: unless there are some transactions spending with the redeem script of this segwit address (which usually reveals the redeem script in clear hex format), there is no way to get to the root data. But then again if you have the redeem script, it is a structure like this:

OP_0:    00
Length:  14
keyhash: (20 bytes)

again with the hash of the corresponding "type 1" key.
In this link Pieter said you can't, and shouldn't.

So best for your work is to extract all priv keys from the wallet, and do "the reverse work". Take a priv key, and create the type 1 address from it (never expose your priv keys online, you will loose the funds! You need to do this offline!). A good page on how to do is here.

After having the "type 1" address, you may convert it to segwit address, and use again the same pubkey to go through this.


Can an attacker change an old block without changing the checksum? Since multiple values can result in the same hash, couldn’t an attacker try to find a way of increasing his balance in a way that the checksum of the changed block remains the same (so that any proofs-of-work are still valid) and then propagate the change into the network without peers noticing it?

Sure, he can try. But the algorithms Bitcoin uses were specifically chosen to make this attack completely impractical. It would be trillions of times easier to just buy the Bitcoins.


os.getpid() in Bitcoin's python test scripts - What does it actually do? I was looking at ../qa/rpc-tests/util.py in order to figure out how arbitrary ports are assigned to each created node.
In the first lines of the code it says:

  ...def p2p_port(n):return 11000 + n + os.getpid()%999...

So I'm wondering what exactly os.getpid()%999 does?
Is it instantly looking for a free port?

Thanks in advance!

os.getpid() in Python is getting the current process id. The processor id is 'random-ish', in that running the entire test several times will result in a different pid, but within the same test the pid will remain constant.

The % operator is the modulus operator, which is essentially chopping off all but the last 3 digits of the processor id.

Together os.getpid() % 999 is getting a constant offset and ignoring all but the last 3 digits. This new 3 digit number of added to the constant 11000 to return the port number to use.


who is sending all the 120-140 satoshi/byte transactions? In the last few weeks, the mempool size has grown significantly. You can see with a mempool fee viewer such as this one that overwhelmingly, transactions are growing at the 120-140 satoshis/byte fee range.

Why would this particular level grow so much faster than any other level? Is there any activity that is more likely to be in these transactions? (like sending money to exchanges, activity from certain wallets, certain blockchain services, etc...?)

I noticed that blockchain.info wallets recommend fees in the 120-140 s/B range. I've been manually increasing my fee to ensure my transaction gets confirmed by checking https://bitcoinfees.21.co/ when I send money anywhere.

I would assume there is simply an error in how blockchain.info and potentially other wallets are calculating the appropriate fee.


For tax purposes, how much is Bitcoin is worth if you send it to an exchange and sell it immediately for fiat? In the United States, I read that people that sell Bitcoin for USD will pay taxes based on the difference of when you bought and sold. How does an exchange like Coinbase know how much your BTC is worth if you just send BTC to them and you sell it immediately? RobinHood or PayPal do not allow you send crypto to other addresses, so they know the Bitcoin price when you bought and sold.

Tax questions should largely be off-topic here, as they are so jurisdiction-specific. But nonetheless, a general answer is sort of possible here:
In many jurisdictions, you will be liable to pay capital gains taxes when you make profit buying and then later selling some asset. This tax is calculated when you report your taxes to your local tax authority, so you simply need to keep track of the prices you buy and sell your bitcoin for.
The exchange you buy/sell from will probably be keeping track of this as well, but in some cases they may only have partial info (eg, the sell only). So you will need to keep track of the rest of the info yourself, in order to correctly report your investment activities.


Receiver email address Can the receiver's email address be obtained from the Bitcoin address? I accidentally sent money to this address:

14gpxmEMrzCpEEp2GZhbUfP5cgBmwtVs9T

Thanks.

No, an email address cannot be obtained from a Bitcoin address. Addresses can be generated on an offline PC by someone living in a desert who doesn't even have an email address.

Most wallets won't ask you to provide any personal information, they won't even ask you which country you live in, let alone contact information like an email address. Such personal information usually only obtained when you register for an account on a website. I, for example, never gave an email address of mine out to obtain a wallet. And even if the owner of that address used a web wallet which requires them to state their email address (web wallets don't even have to do that, it's just something they usually do), this doesn't mean that anyone but the service provider has access to that contact information. Depending on where the service provider is located, it might even be illegal for them to share users' contact information with others.

I don't know where you got that address from but if you sent money to a random address, chances are that no one has access to it and the UTXO generated is forever unspendable.


How much time to re-mine blockchain at current hashpower? It has taken 9 and half years to mine all blocks averaging 1 per 10 minutes.

How long would it take to re-mine all current blocks at current hashing power?

it would take approximately 9,5 years because it does not matter how many hash-power you have. the mining-difficulty will be adjusted so that in average a new block is still mined every 10minutes also if you get much more hash-power.


Can a cryptocurrency exist in a closed system? I am developing a online game that requires a realistic economy and currency.

I know I can create a new crypto coin currency with out much effort.  What I am unclear on, is it possible for me to mine all the possible coins of my currency, and then distribute them as I see fit within that game environment?

My aim is to spare myself the effort of creating elaborate wallet and asset management systems in the game.

You could do this.

What you're describing is typically called a 'premine.' Ripple launched this way, and distributed half of the money, and kept the other half for development.

But from the sound of things, that's not really what you're looking for. For example, would you be okay with players transferring ingame currency in return for real money? Is it an important feature for players to be able to keep funds that aren't associated with any in-game account?

There are various things you can do to prevent those sorts of things, but they largely defeat the point of using a cryptocurrency.

Using cryptocurrency probably won't save you any time, either. At a rough guess, implementing a Bitcoin-derived solution for tracking player balances will take roughly fifty times more development time than a centralized solution.

Instead of creating a cryptocurrency, I suggest using a SQL table to track how much balance each player has. This is

faster,
simpler, and
allows easy central modification.


Storing private keys in cloud providers enviroment variables Is it ok to store private keys in cloud provider (such as AWS, Firebase) secrets (enviroment variables) in cloud functions (such as lambdas or firebase cloud functions)?
I understand I would be trusting the safety of the funds in that address to the cloud provider, but I can't see another solution since I am building an application that has to sign bitcoin transactions from that address.

If the private keys are visible to you on your AWS account, then they'd be visible to anyone who has your session tokens (i.e. if a hacker would simply need to take your cookies to view the keys). So it's not only the cloud provider you'd need to worry about.
Always best to sign transactions on your own node which has no connection to your online accounts. You can build the transaction on your app, and send it off to be signed on your own server.
BitGo has some cool functionality that allows admin-approved transactions and multisig.


Electrum. Payto argument from_addr I need to specify address to send from.
I want to use option createnewaddress. And then send money from this addresse useing payto and from_addr option.
When I do like that, i got error message not enough funds.
When i do payto without argument, it use first unused address (that i create before with createnewaddress).
How can i send payment from specified address ? Or transfer amount on specified address.

Not enough funds usually means that you've confused the unit of account i.e. mbtc vs. btc or you're not accounting for transaction fees including 2fa fees if you have a 2fa wallet. I suggest you use the exclamation point in place of a numeric amount to see what is the max amount you can send. Decoding the generated transaction should be illuminating.


Does the backup (Bitcoin QT) saves my BTC if i create thousands of addresses? I'm using the latest version of Bitcoin QT

Just encrypted it and backed it up.

If i generate 20.000 addresses, and transfer BTC to this addresses.

Would the backup i made recover all my BTC?

Thanks.

If you're using an HD wallet, then yes.  This would be the case if you created the wallet from scratch with the latest version of Bitcoin Core using default settings.  However, if a lot of those addresses were unused, you might have to use special options to increase the gap limit when attempting to recover from the backup, or it might not regenerate enough addresses.

If you're using a non-HD wallet, then no; in that case you have a keypool of 1000 keys.  So when you make a backup, it will be able to recover coins from the next 1000 addresses you generate, but no more than that (unless you use the appropriate command line option to enlarge the keypool).  This would be the case if you created the wallet with an old version and then upgraded, or if you set the command line option to use a non-HD wallet.


Why is the value field 8 bytes in transaction output when it can be achieved with 7 bytes? Bitcoin uses a 8 bytes value field in the transaction output. However, the total supply of bitcoin is capped at 21M. Theoretically, even if all the 21M bitcoins are transferred to a single address, the output, after converting to satoshis, can be effectively represented with 7 bytes of data. This means, we are adding at least 2 bytes of redundant data (one for the spend address and other for change address) for every transaction stored in the blockchain. Is there a particular reason why a size of 8 bytes was chosen or was this a design flaw that was overlooked by Satoshi? Is it possible to bring a change to this via a soft-fork or does changing this require a hard-fork?

Is there a particular reason why a size of 8 bytes was chosen

Probably not.

In the original Bitcoin source code, many of the primitives used in data structures were simply the in-memory representations of those primitives. For integers, this is a 32 bit (4 byte) little endian integer. However 32 bits is not enough to represent all of the satoshis that exist in Bitcoin. The next primitive that can be used is a long, aka a 64 bit integer. Since this was just serialized as it is represented in memory, the amounts end up being 64 bit little endian values.

  Is it possible to bring a change to this via a soft-fork or does changing this require a hard-fork?

The serialiation format used for computing the weight and hashes can only be changed via a hard fork.

However you can transmit a transaction using whatever serialization you want so long as that format contains all of the necessary information to construct the serialization necessary for computing weight and hash. This would not require any fork because it is not a consensus change.


Does Ripple allow one to issue their own currency? Does Ripple allow one to issue their own currency, similar to how ripples (XRP) were created at the system's inception?

Currently, only three-letter currencies that exist as IOUs can be created as a custom currency. And if someone else uses that same three-letter identifier for something else, each account can only transact in one of those conflicting currencies. So you could use "XBR" to mean people owe each other beers and you could use the ripple system to track how many beers you owe people or they owe you. You could accept payment in beers.

There are plans to introduce more customized currencies. There are some things you can't do without some specialization. For example, charging a storage fee as some gold storage agents would like to do. This is still in the design stages.

You can, of course, create IOUs denominated in any currency, subject only the what other people are willing to take. But if you want to create two accounts and have one owe the other $1,000,000, you can.


Is this a genuine bitcoin minning app? Please can someone explain if this is a  genuine app for bitcoin mining?

No, a mobile device cannot mine bitcoin.

These days, mining bitcoin requires specialized computer hardware called ASICs. They are loud and hot, and incredibly efficient at computing the SHA256 mining algorithm. A mobile device is not like this at all, it is not optimized to compute SHA256, it is meant to be a general-purpose device. Trying to mine bitcoin using a mobile device would be a literal waste of money (electricity), and you would receive no bitcoin in return, because your device would not contribute a meaningful amount of hashpower to the network.

The app is likely malicious, I would remove it from your device.


How do I ensure that the multisig transaction that's signed by multiple parties is the same? In multisig 2-3 escrow, what is best approach from below ?

1- Say I want to sign a rawtransaction from a customer and send it to escrow to sign so that 2 of 3 sigs are there to release fund.
But how do I ensure that rawtransaction is the same one that I created and not modified or created from customer ?

createrawtransaction '[{"txid":"564876",
"vout":0,"scriptPubKey":"8645231554",
"redeemScript":"2315454"}]'
'{"d5adf5sdf5s45":0.00015000}'

0df0sd0fsdfsdfs11dfs

signrawtransaction
'0df0sd0fsdfsdfs11dfs'
'[{"txid":"txid":"564876",
"vout":0,"scriptPubKey":"8645231554",
"redeemScript":"2315454"}]'
'["erwerw8e888"]'

{
"hex" : "0e0rw1e1rw1er1we1rw",
"complete" : false
}

It's possible the customer created his own rawtransaction and signed it and sent it to me, how do I ensure it is the same raw transaction that I created ?

2-Send sign rawtransaction to customer to sign 2-3 to release fund?
But how can I know if a customer made his own sendrawtransaction? Does there exist any bitcoin api rpc to test if customer already released funds?

Your server creates the transaction, so it knows what to compare it to. I create a json array of the outputs, hash and store the resut. Later when a user submits a partially signed, or fully signed transaction, I need to check it's valid.

First verify the inputs are the correct txid's, and that a signature was added by that user by doing ECDSA signature verification. This parts tough, look at http://en.bitcoin.it/wiki/OP_CHECKSIG. Then compare the hash of the outputs against what you're expecting, since if an address or amount changes, you'll get a different result.


Action taken when data of a block gets tampered with Let's say we have a Blockchain consisting of 10 blocks, indexed from 0(Genesis Block) to 9(The last block).

If the data of a block, say block 5, is changed(maliciously), the data stored on the block, as well as subsequent blocks, becomes invalid.

What happens next?

It is impractical to drop the blockchain entirely. It is also impractical to recalculate all the hashes, in case of larger chains.

So, how is data of the current block, as well as that of other blocks, preserved in the event of an attack on a single block?

I believe that if the data of one block is maliciously altered on one node, this would likely affect signatures relating to affected data.

All other nodes would ignore any blockchain data and transactions from that node which are affected by the changes made.

For example, any other nodes obtaining that block from the malicious node would either notice that it's checksums and signatures were invalid or would notice that there is a competing chain (based on an unaltered block) which is longer and more trustworthy.

Wallet software, when synchronising, does check the validity of each block received. This means it is not impractical to do this for the entire blockchain (although it does contribute to the time that initial synchronisation takes)

Some wallets don't need to check really old blocks because they have hardcoded within them, checksums for blocks at release date. They can still distinguish blocks built upon on differing earlier blocks (because changes to significant data in earlier blocks affect the checksums of blocks built on that)

The upshot is that making changes to old blocks doesn't give anyone the ability to spend bitcoins they wouldn't otherwise have had.

Useful links

https://bitcointalk.org/index.php?topic=2129247.0
What are the trust assumptions in --assumed-valid in bitcoin core 0.14?


How does lost BTC affect the market in the long run? I bought some bitcoins in 2012 and forgot about it. Now years later I discovered that the company who maintained the wallet went bankrupt and their website no longer works.

I therefore have lost access to my bitcoins forever.

I assume my story is not the single case where this happened.

As there is a limited amount of bitcoins, what will happen as more and more people lose access to their wallets with time?

What would be the effect on the market?

The price of bitcoin is affected by demand and scarcity.

Scarcity decreases as more bitcoin are mined (up until the 21 million bitcoin limit is reached---this is the maximum number that can ever be mined), which decreases the price. Scarcity increases as coins are lost (e.g. through the destruction of a wallet), or just held indefinitely (e.g. the ~1 million bitcoins of Satoshi Nakamoto that 'may' never get spent). Therefore, with demand staying above the number of coins available the price will continue to increase (as people are willing to pay more to be the one able to buy the coins, beating out the others also wanting to buy them).

Now obviously if we look far ahead (assuming bitcoin survives long enough), there is the foreseeable problem that ultimately the number of bitcoins in circulation will decrease to the point that eventually one satoshi (0.00000001 BTC), the minimum value one can currently hold, will be worth more than a desired minimum, e.g. one could be worth $2000, limiting bitcoin's use to only larger transactions. Thankfully the number of decimal places in bitcoin isn't a hard limit, so this could be increased in the future such that it wouldn't matter if there were even only one bitcoin in the world.


Why is the smallest transaction value 5340 satoshis? What is so special about that particular number? What is so special about 5340 instead of some other number? E.g. why not 5320 or 5345?

The smallest transaction value is actually 0 as you are allowed to create 0 value outputs. However such transactions are considered non-standard and thus will not be relayed. But they are completely valid if they appear in a block.

The smallest standard output value (also known as the dust limit) changes with the fee rate. The dust limit for a given fee rate is defined as the amount of Bitcoin where spending the output would result in all of the output's value being paid as transaction fees.

Currently, the dust limit fee rate is 3 satoshis per byte which makes the dust limit 546 satoshis, not 5340. The 5340 satoshis dust limit comes from a time when the dust limit was actually defined differently and the dust fee rate was higher.

The previous definition (no longer used, but was the one used when 5340 satoshis was the limit) was the amount at which one third of the amount would be paid in transaction fees. To make calculations easier, this was redefined to the current definition and the default dust fee rate for calculating this was multiplied by 3. Under this definition, the dust fee rate was ~10 satoshis per byte.


Why there is no block index or block height included in the block header? Why block index or block height is not included in the block header?
Do we have to go through the whole chain if we want to know how many blocks are there in a chain?
On the other hand, if some blocks have the same hash, how to find them and get their content individually?

The chances of two blocks having the same hash are extraordinarily low. Having the same hash would essentially ensure that they must be the same block (two copies of the same block with the same transactions at the same height with the same ancestor).

While the blocks themselves do not contain the height, most full node software keeps track of the height of each block. In Bitcoin Core you can use getblockchaininfo to see how many blocks your node has or, getblockcount to see how many blocks your node knows about.


Creating An Altcoin: How to Lower or Increase Confirmation Times? When Creating an Altcoin for fun, what variable/attribute do I change in main.cpp file to increase/lower the time it takes for confirmations to take place?

Also can the confirmation times be changed again after coin is re-compiled/re-built?

Thanks.

See the variable nTargetSpacing.  The difficulty adjustments will try to steer the average block time towards this value (in seconds).

You can't change this at runtime.  In fact, you can't easily change it at all once you've released your coin.  All clients on the network need to agree on this number, since it is used to calculate the required difficulty.  If you change it after release, then there will be a disagreement between old and new clients as to whether various blocks are valid, and your coin will have a hard fork.


Bitcoin 0.17 No public key shown (validateaddress) I want to generate multisignature address with person, which I didn't know.

Someone send me a public key. Then I do:

bitcoin-cli getnewaddress "" legacy

Ok, I got

1QKVwuQnu69HgsMVvynFhApYmmdLf8bMKT

After that, I need to know my own public key:

bitcoin-cli validateaddress "1QKVwuQnu69HgsMVvynFhApYmmdLf8bMKT"

But v.017 do not give me a public key:

{
"isvalid": true,
"address": "1QKVwuQnu69HgsMVvynFhApYmmdLf8bMKT",
  "scriptPubKey": "76a914ffca8b339408c5eb664513f62c98256c5edcc98b88ac",
  "isscript": false,
  "iswitness": false
}

Is there any way to generate multisignature address (2 of 2) if wallet do not know one of this addressess ?

validateaddress has changed to be separate from the wallet, so it cannot look up the public key information for an address. Use getaddressinfo instead in order to get all of the wallet information for an address, including the public key.


How Lightning channels will helps with scaling in practice I watched the 2015 presentation of LN, and I've read a portion of the paper - so I understand basically how the channels work (I think).  However, I'm not sure I've fully grasped how this will help scalability in practice.

If Bob and Alice want to transact (let's say Alice is a random internet retailer - not Amazon - and Bob wants to buy waaaaaay too many tattoo stickers for his daughters for Christmas, not realizing that each little package has like 40 sheets of the things).  Bob would then have to open a channel with Alice, transfer the balance required to complete the purchase, and then the channel would be closed.

For pretty much all economic relationships except for a few enormous ones (Amazon, eBay, Walmart, etc), you won't (and wouldn't be able to) keep open channels all the time.

From these two observations, I wonder: wouldn't the process of opening / closing a channel actually create two transactions to be processed on the blockchain?  If most transactions are between actors who don't maintain channels between themselves, then how does LN actually help?

If the answer is "you keep open channels with a small number of other actors and then route payments through open channels", doesn't that encourage a very high degree of centralization due to the prohibitively large capital requirements for main hub nodes?

You would not open and close a channel for each transaction.  Instead, you would have one or more open channels at all times and find routes to the places yours want to send money.

  doesn't that encourage a very high degree of centralization due to the prohibitively large capital requirements for main hub nodes?

No.  If you make a transaction of about 50 USD, any route from Bob to Alice where all channels are greater than or equal to 50 USD (in the right direction) will do.  It does not have to go through a central hub.  50 USD is not a "prohibitively large capital requirement".  If you make a 50,000 USD transaction, it's a different story.  With lightning, the network is more centralized with larger transactions because you have fewer routes to choose from.  However, the vast majority of transactions aren't going to be very large, and therefore will have a very low degree of centralization.  They can use more routes.

Because small transactions will no longer require space in blocks, this will take significant load off the main chain.


What is the size and weight of a P2WPKH input? I'm investigating diverging P2WPKH input size calculations on two Bitcoin projects and some blog posts. I'm looking for a detailed explanation of the exact weight, vsize and serialized length of a P2WPKH input, in the same vein as How big is the input of a P2PKH transaction?.

TL;DR:
A P2WPKH input should be conservatively estimated with 68.0 vbytes. Standard P2WPKH inputs generally weigh 67.75 or 68.0 vbytes, depending on whether the r-value in the signature is low or high. A wallet using signature grinding (which is highly recommended) will always produce 67.75 vbyte inputs. 68.0 vbytes is the conservative estimate allowing for high-r signatures.
Composition of a P2WPKH input
Each input commits to spending a specific UTXO by providing its transaction outpoint:
PREVOUT: hash (32 bytes)
         index (4 bytes)

The scriptsig for a P2WPKH input is empty, however, the scriptsig length must be provided as 0:
SCRIPTSIG: length (1 byte)
  <no content>

Each transaction input has its own sequence number:
sequence (4 bytes)

A P2WPKH input requires a witness in the transaction's witness block:
WITNESS: item count (1 byte)
  signature length (1 byte)
  signature (71 or 72 bytes)¹
  pubkey length (1 byte)
  pubkey (33 bytes)

Conservative weight, vsize, and size estimate
A P2WPKH transaction input adds to a transactions…
weight:
4 × (32 + 4 + 1 + 4) + 1 + 1 + 72 + 1 + 33 = 272 WU

vsize:
32 + 4 + 1 + 4 + (1 + 1 + 72 + 1 + 33) / 4 = 68 vbytes

serialized byte length:
32 + 4 + 1 + 4 + 1 + 1 + 72 + 1 + 33 = 149 bytes

If the signing wallet uses signature grinding, the r-value is always 32 bytes, reducing the signature to 71 bytes and the above maxima to 271 WU, 67.75 vbytes, and 148 bytes respectively.
Note that using at least one segwit input adds 2 witness bytes to the transaction header, the witness marker and witness flag. Also, when there is at least one segwit input, the witness block must have a witness count item for every input, which must be provided as a 0x00 byte for non-segwit inputs.
The overall transaction elements of a segwit transaction therefore are:
version (4 bytes)
witness marker (1 WU)
witness flag (1 WU)
input count (1 byte)
  inputs (variable size)
output count (1 byte)
  outputs (variable size)
witness item counts (1 WU × input count)
  witnesses (variable weight)
locktime (4 bytes)

Mentioned for completeness, a P2WPKH input that has a non-standard signature with both high-s and high-r weighs 273 WU, 68.25 vbytes, and 150 bytes accordingly.

¹ also see What is the maximum size of a DER encoded ECDSA signature?.


What should I use as a login and password while connecting to the bitcoin daemon I'm creating a pool, right now I'm trying to connect to bitcoin daemon, it responses with error "401", "HTTP Error 401 Unauthorized".

What should I enter in "login" and "password" fields?

Locate your bitcoin.conf file (https://en.bitcoin.it/wiki/Running_Bitcoin#Bitcoin.conf_Configuration_File) and add these lines:

rpcuser = MyRpcUsername
rpcpassword = MyRpcPassword
server=1

These are the credentials you should be also using in your program.


FutureBlock offer and example seems to violate No Arbitrage Rule If you look at, e.g. the best offers at the 420 BTCUSD strike price (this was as-of 4:15 pm EST on November 14, 2013), or at the "How It Works" page for Future Block, it seems like there is a violation of the No Arbitrage Rule.

For example, from the "How It Works" example. Suppose I sell one BTC's worth of "up" contract (I get 1 BTC) at 80% payout (I pay back 1.8 BTC if price is above strike at expiry).

Next, I sell one BTC's worth of "down" contract at the same strike price (I receive another 1 BTC), at 50% payout (I pay back 1.5 BTC if price is below strike at expiry).

If the price is above the strike, the "up" contract clears and I received 2 BTC but pay back 1.8 BTC (netting a gain of 0.2 BTC for me). If the price is below, the "down" contract clears and I receive 2 BTC minus the 1.5 I pay back (netting a gain of 0.5 BTC for me).

Obviously, these example offers may not be close enough to the best offer to attract buyers, but apart from that I can't see any specifications for transaction costs to the seller, fees, etc. Even if there were fees, wouldn't they need to adjust according to the payout rates a seller could command selling on both sides of a strike price?

I think I am probably missing an obvious detail; any help correcting my mistake would be great!

Added:

To clarify, the puzzle here is that at about 4:15 yesterday, the best offer for up and down contracts roughly matched the example I give above, using numbers from the "How It Works" page to illustrate a Dutch book offer selling on both sides of the strike price. That this can happen is not a mystery per se, but that the live best offers reflected that it was a viable live strategy even when there was resonable volume in the market is a puzzle. Either there was simply no volume at all on one side of the strike price (which should have immediately led to better offers on that side) or else there was actually not much participation and the volume data was incorrect / misleading, or both. (Assuming that early adopters of BTC options can't be that irrational... after all, they'd have to know a lot about bitcoin and that particular options platform even to participate. So it seems implausible that buyers were so irrational as to be buying at such prices on both sides of a strike price).

It is a well-known observation that Bitcoin exchanges are not efficient (in the academic sense of well-approximating what you call the No Arbitrage Rule). The reason is simply that there are real world barriers that academics usually assume not to be present. If you do consider the risk associated with depositing funds at a Bitcoin exchange, there is an obvious reason why someone would demand a high return for taking such a risk. If you look e.g. at the difference in exchange rates between big exchanges (try Mtgox, Bitstamp, BTCE) you'll see that a difference as large as 10% can persist on the timescale of a year.

The risks include having the exchange hacked and leaving it unable to return your deposit (have a look at Bitfloor) or having its bank accounts frozen during legal investigations and hence unable to return your deposits during the first 6 month or so (check bitcoin-24.com). And then there's the combination of it all with (presumably) enough reserves not to shut down the operation right away (e.g. mtgox). And that's not even considering the risk that the operator is dishonest and gets tempted to defraud customers...

On top of all this, consider that even moving Bitcoins around is not instant. You run the additional risk that during the transfer time the situation changes (e.g. a crash in Bitcoin exchange rate). And the transfer time between bitcoin trading sites can be surprisingly long, since some legislation (e.g. anti money laundering) typically seems to compel them to insist on verifying your identity. This process may, depending on the site, occur in a somewhat surprising fashion, so you never know if they will instantly, or at least within the first days, allow you to continue accessing your bitcoins (or real money) that you gave them.


Bitcoin Core cannot obtain lock I downloaded Bitcoin Core (64 bit) and I am still waiting for it to synchronize. But just now, when I open the software, it loads from 1% to 100% and then a message appears with the inscription

  Cannot obtain a lock on data directory C:/Users/ADMIN/AppData/Roaming/Bitcoin. Bitcoin Core is probably already running.

Then the program disappears to the task bar and I can't open it from the task bar. Please, any help?

Try opening your data directory and deleting the file .lock

Make sure Bitcoin is closed while you're doing this.


Trading between different cryptocoins Is there a website that allows one to trade multiple different cryptocoins (Bitcoins, Namecoins, SolidCoins, RuCoins, LiteCoins, etc) all in one place?

BTC-E currently offers trading pairs of BTC/USD, BTC/RUB, SC/BTC, SC/USD, GG/BTC, TBX/BTC, FBX/BTC, LTC/BTC, LTC/USD, RUC/BTC, RUC/USD, RUC/RUB, NMC/BTC and RUB/USD


How do you spend a P2SH transaction? I've been running into a lot of trouble getting a transaction to spend coins in a multisig address.

I create the raw transaction
When I go to sign, I get "Operation not valid with the correct stack size"

I'm using core, and the codes are here.

First, check if it's good.

bitcoin-cli decoderawtransaction 0100000001d2aba456546be8f5223802112637e484c5d94118dfe560fa23de06fb37e621dd0000000000ffffffff01107a0700000000001976a914a4f29e1c8f592021fd79eda1be85c96a9a8d349a88ac00000000
{
    "txid" : "e71006c60dbfa2793710d5cf866d1b6b89ba80bc41634031d927738c40ae8228",
    "version" : 1,
    "locktime" : 0,
    "vin" : [
        {
            "txid" : "dd21e637fb06de23fa60e5df1841d9c584e4372611023822f5e86b5456a4abd2",
            "vout" : 0,
            "scriptSig" : {
                "asm" : "",
                "hex" : ""
            },
            "sequence" : 4294967295
        }
    ],
    "vout" : [
        {
            "value" : 0.00490000,
            "n" : 0,
            "scriptPubKey" : {
                "asm" : "OP_DUP OP_HASH160 a4f29e1c8f592021fd79eda1be85c96a9a8d349a OP_EQUALVERIFY OP_CHECKSIG",
                "hex" : "76a914a4f29e1c8f592021fd79eda1be85c96a9a8d349a88ac",
                "reqSigs" : 1,
                "type" : "pubkeyhash",
                "addresses" : [
                    "1G3ATq31k5SrGdqucXKqA9dHbzS3wJHzbc"
                ]
            }
        }
    ]
}

And then we go to sign.

bitcoin-cli signrawtransaction 0100000001d2aba456546be8f5223802112637e484c5d94118dfe560fa23de06fb37e621dd0000000000ffffffff01107a0700000000001976a914a4f29e1c8f592021fd79eda1be85c96a9a8d349a88ac00000000
{
    "hex" : "0100000001d2aba456546be8f5223802112637e484c5d94118dfe560fa23de06fb37e621dd000000009200483045022100eaae5737ab000f614ce73da11ba456b4467cf640ed881fd1fa90183d1d28c2e8022066c78bf750ae0a175f6ef116ecc3e4a0c18eda1aff9c951952f8f6e45a3521ad0147522102908921b30aa37fe6e522c528cca0ebcda9f0df4019301fa45bc3b3c7df60245a2103559dc92d6e44a98080d487e585b93278106249a166795584ae554a4275f059b752aeffffffff01107a0700000000001976a914a4f29e1c8f592021fd79eda1be85c96a9a8d349a88ac00000000",
    "complete" : false,
    "errors" : [
        {
            "txid" : "dd21e637fb06de23fa60e5df1841d9c584e4372611023822f5e86b5456a4abd2",
            "vout" : 0,
            "scriptSig" : "00483045022100eaae5737ab000f614ce73da11ba456b4467cf640ed881fd1fa90183d1d28c2e8022066c78bf750ae0a175f6ef116ecc3e4a0c18eda1aff9c951952f8f6e45a3521ad0147522102908921b30aa37fe6e522c528cca0ebcda9f0df4019301fa45bc3b3c7df60245a2103559dc92d6e44a98080d487e585b93278106249a166795584ae554a4275f059b752ae",
            "sequence" : 4294967295,
            "error" : "Operation not valid with the current stack size"
        }
    ]
}

I'm using https://gist.githubusercontent.com/gavinandresen/3966071/raw/ca21870c190ba0e90c1a30673e790ef5acd207d2/TwoOfThree.sh for reference.

You get this error because Bitcoin has tried to validate the script, and failed, because not all of the signatures necessary were added in the previous signrawtransaction. You can also tell this because complete is false.

You need to take it to clients that have the other keys necessary, and run signrawtransaction on the transaction there too.


How do I know that the majority of bitcoin miners are not XYZ government's facilities? Even if "Satoshi Nakamoto" is/was actually a real person, how can I be sure that XYZ government (XYZ can be US, or China, or ...) does not have now (or will not have in the future) 51% of the hashing power to mess with the bitcoin network transactions when the right time, in their opinion, comes?

Your answer is Incentives.

Let's imagine a bad guy, called Mallory, has an interest in attacking Bitcoin and has either created for himself, or desires to, 51% of the hashing power required to start shenanigans. (Start, because he has to maintain and grow that hashing power for sufficiently long to outpace the 'good guys'.)

To start with, there's no technical or legal way to prove that Mallory hasn't, or cannot, obtain that 51% any more than than there's a technical or legal way to prove Mallory hasn't, or cannot, obtain nuclear devices to hold the world to ransom like a James Bond villain.

Instead, you're relying on incentives. Assuming Mallory has spent $1 billion to marshal his forces, you have to wonder - would it make sense to destroy Bitcoin? If he does, his $1 billion is lost. True, perhaps he plans to make $1.1 billion from the chaos, and so the cost - to him - is "worth it". Or is the cost now so high that even Mallory stops and thinks "Hey - I'm making $0.1 billion a year from securing the network. It's actually more profitable to keep doing that, even though I'm a bad guy."

It's also worth pointing out his 51% only allows him to double-spend money he's already spent.

You specifically suggested that Mallory is a Government. We can look again at the incentives above: if his interest is to destroy Bitcoin as an alternative, then he'll quickly run into trouble: everyone will rapidly know that the 51% was achieved and so everyone will know that someone (Mallory will not likely reveal himself) has mining resources previously unknown. Perhaps a more efficient SHA-breaking algorithm. Even if Bitcoin itself is flown into the ground by him, alternate algorithms can be put into place such that a Bitcoin2 is immune to his attack. So: Mallory has now spent huge amounts of his resources, revealed something that would be of interest to his existing adversaries (that he has a means to break an encryption algorithm they use) AND has found himself back at step 1: Bitcoin2 is up and going without him. What attacker deliberately makes his own position worse?


Unconfirmed transaction, fees paid, seem to be two payments Transaction id: 601536cadb0055cee97b4ff7969c707bea18745168fe6fedae95f854b2168b11

I made this transaction several hours ago. It seems like it is stuck at being unconfirmed even though I paid a transaction fee of 0.000129 BTC.

I can see the transaction details at: https://blockchain.info/tx/601536cadb0055cee97b4ff7969c707bea18745168fe6fedae95f854b2168b11

I don't understand why there are two payments. Really confused as to what is going on and what the outcome will be. Will this transaction ever get confirmed? Will it eventually time out if it doesn't enter the blockchain and the BTC transfer back to the originating wallet?

Really appreciate any help here. Thank you.

1) confirmed

2) change

I do not know what else to say. Why don't you read the basic docs before using this technology?


Can't understand arbitrage profit calculation Found the formula in the following link. I can't understand with my knowledge. Can anybody explain me with an example?

profit = ExchangeA_sell * (1 - ExchangeA_fee) - ExchangeB_buy * (1 + ExchangeB_fee).

One more thing, Is this formula good for all exchanges? Cryptsy and Bter have calculated differently their net total. Bter sell offer is different from cryptsy sell offer. In Bter the trade fee is deducted just opposite to cryptsy in terms of buy and sell currency?

As explained by http://www.investopedia.com/terms/p/profit.asp:

  profit = total revenue - total expenses

or in plain English:

profit = (what you had received after selling all your coins) - (what you had paid to buy your coins)

so, for example:

If you had spent $1000 for Bitcoin priced at $500/BTC on exchange A, and say the fee is 1%, you will received

$1000/$500*(1-0.01) = 1.98 BTC

If you move and sell your 1.98 BTC at for $600/BTC on exchange B, which also charges a 1% fee, you will receive

1.98*$600*(1-0.01) = $1176.12

So your profit will be

$1176.12 - $1000 = $176.12

Remember to also subtract any withdrawal/deposit fees if applicable.


Can you help me fix this address? I just got this address: 1a8LDh3qtCdMSAgRXzMr4zB8w1EG4h1Xi, but the checksum doesn't validate. Can someone help me fix it by changing some characters that look/sound similar?

Just for fun, here is some code I threw together that will try substituting up to n characters to try to make a valid address.

As a disclaimer, there's no guarantee that any address it finds is actually the "right" one; it could be a different address that is valid but doesn't belong to anyone, in which case any coins sent there would be lost forever.  Use at your own risk.

Running it with n=3 found the address

  1a8LDh3qtCdMFAgRXzMrdvB8w1EG4h1Xi

which has a balance of BTC 29658.80268195.  It appears to be the current resting place of the Bitcoins seized from Silk Road that were auctioned today.

To compile (on Linux):

gcc -O3 -o subst subst.c -lssl -lcrypto

You will need the OpenSSL headers and libraries installed.

To run:

 ./subst 2 1a8LDh3qtCdMSAgRXzMr4zB8w1EG4h1Xi

Will try to replace up to any 2 characters to make a valid address.  You can replace 2 by 1 if you are impatient, or by a larger number if you are very patient.

Here is subst.c.  There is an unused function to try transposing characters from the address, but it is redundant with n >= 2.  The validation code is from Rosetta Code.

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <openssl/sha.h>

const char *coin_err;
#define bail(s) { coin_err = s; return 0; }

static const char *tmpl = "123456789"
        "ABCDEFGHJKLMNPQRSTUVWXYZ"
        "abcdefghijkmnopqrstuvwxyz";

char *xstrdup(const char *s) {
    char *p;
    p = strdup(s);
    if (!p) {
        fprintf(stderr, "How can you be out of memory?\n");
        exit(1);
    }
    return p;
}

int unbase58(const char *s, unsigned char *out) {
    int i, j, c;
    const char *p;

    memset(out, 0, 25);
    for (i = 0; s[i]; i++) {
        if (!(p = strchr(tmpl, s[i])))
            bail("bad char");

        c = p - tmpl;
        for (j = 25; j--; ) {
            c += 58 * out[j];
            out[j] = c % 256;
            c /= 256;
        }

        if (c) bail("address too long");
    }

    return 1;
}

int valid(const char *s) {
    unsigned char dec[32], d1[SHA256_DIGEST_LENGTH],
        d2[SHA256_DIGEST_LENGTH];

    coin_err = "";
    if (!unbase58(s, dec)) return 0;

    SHA256(SHA256(dec, 21, d1), SHA256_DIGEST_LENGTH, d2);

    if (memcmp(dec + 21, d2, 4))
        bail("bad digest");

    return 1;
}

inline void try(const char *s) {
    if (valid(s)) {
        printf("Valid:\t%s\n", s);
    }
}

void subst_int(char *s, char *p0, int n) {
    if (n == 0)
        return;
    char *p;
    for (p = p0; *p; p++) {
        char orig = *p;
        const char *q;
        for (q = tmpl; *q; q++) {
            if (*q != orig) {
                *p = *q;
                try(s);
                subst_int(s, p+1, n-1);
            }
        }
        *p = orig;
    }
}

void subst(const char *s, int n) {
    char *buf = xstrdup(s);
    subst_int(buf, buf, n);
    free(buf);
}

inline void swap(char *p, char *q) {
    char tmp;
    tmp = *p;
    *p = *q;
    *q = tmp;
}

void transposition(const char *s) {
    char *buf = xstrdup(s);
    char *p, *q;
    for (p = buf; *p; p++) {
        for (q = p + 1; *q; q++) {
            if (*p != *q) {
                swap(p, q);
                try(buf);
                swap(p, q);
            }
        }
    }
}

int main(int argc, char *argv[]) {
    int i;
    int n;

    if (argc < 3 || (n = atoi(argv[1])) <= 0) {
        fprintf(stderr, "Usage: %s n addr...\n", argv[0]);
        fprintf(stderr, "Substitute up to n characters\n");
        exit(2);
    }

    for (i = 2; i < argc; i++) {
        char *s = argv[i];
        printf("%s:\t%s\n", valid(s) ? "Valid" : "Orig", s);
        subst(s, n);
#if 0 /* redundant with n >= 2 */
        transposition(s);
#endif
        if (i+1 < argc)
            printf("\n");
    }
    return 0;
}


How to know if a transaction is valid? I understand there are a couple things that need to be checked for a transaction to be valid - the previous transaction had to be correct, no OP can invalidate the transaction, etc, but is there a complete list on what one needs to check in order to know if a transaction is valid?

For example, does the transaction need to have a specific structure in order to be spent, like the script from TxIn needs to compile to the encoded message, and the TxOut script needs to properly run OP_Checksig on that particular message? If not, one could simply drop the message from TxIn, push their own malicious message and run OP_Checksig on that.

What steps does the protocol require a client to go through to check if the transaction is valid?

On the bitcoin wiki, there is rather complete list of validation checks that are done by the Satoshi client: Protocol_rules.

There is a section specifically about transaction checking as well.


Can a person only send large amounts an have a $500 transaction log between us before he could send? How can i get around this? Recently I going to receive a donation from a man and he tried sending a large amount. The amount wouldn't send he said we had to have at least $500 in transactions before it would go thru. Does this make sense ? He said he could only send large amounts. How can I receive the donation without the transaction log?

Sounds like a scam; that's not how Bitcoin works. I wouldn't have high expectations about the outcome of this. The goal is to get you to send them money.

I would say the following:

Send me the $500 and I'll partly refund you once your transaction is confirmed.

This is because, unlike bank transactions, transactions in Bitcoin are irreversible and it's not possible for them to "transact and cancel the transactions".


Is this article wrong/scammy? Is it possible that miner earn more by mining several different coins at once through minergate? https://ambcrypto.com/mining-in-the-bear-market-made-easy-fast-and-cheap-with-minergate/

This one claims they can mine more efficiently by mining several coins at once.

I have a hard time believing that any pool can outperform "normal" pool.

What's the story.

Is this possible? Is this guy legit?

Let's for simplicity sake we got to pick numbers from 0 to 7. Say the hashing function is add 5 modulo 8. Of course the "right" nonce is 3. That's because 3+5 is 0 module 8.

Say the hash/signature or whatever of the transaction is 1. Mining is finding an extra nonce, if added to 1, would hash to 0 (or below difficulty). Something like that right. We try and found that the extra nonce is 2.

Say we have 2 coins. Say the starting nonce is 1 and 2 respectively. I wonder if it's possible to to add extra nonce to 1, then try to find an extra nonce where the hash is 0. Turns out if we add 1 to the extra nonce, we got the right answer.

We just add all the extra nonce and got the nonce that hash to the right number for 2 coins.

Is that possible?

My understanding of how mining works is quite a bit shaky here.

Is my understanding correct?

Is miner gate offering merge mining for coins that do not support it?

You can possible optimize revenue by switching to mining another coin dynamically, but it isn’t possible to mine two different coins in a given grind attempt.

The exception are chains which are merge-mined. Each merge-mined chain block is committed to a block of a main-chain block, a Bitcoin block for example. Validators of the merge-mined coin can validate POW of the main-chain (eg Bitcoin) and enforce separate consensus rules.

The difficulty of a merge-mined coin can be equal or higher than that of the main chain.

Therefore, if there is any significant value in the merge mined coin, a Bitcoin miner would be incentivized to include valid block commitments in each Bitcoin block it attempts to mine.


Transaction verification engine In the Features of Bitcoin Core i found following Line:
"Bitcoin Core includes a transaction verification engine"

Please define Validation, is Validation = verify or not.
Does the Engine verify everything what is coming through and i just have to pay for Power, Online Time, Memory and so?

I ask because of all the time when I run a full node I NEVER had to verify a transaction coming through, no Blocks, nothing. I was wondering why my Budget didn't move a single satoshi up or down. I don't get it maybe you do.

In Bitcoin, any transaction that confines to the consensus protocol is valid. This is unlike other ledger based system like Ripple, where the validators vote on whether the transaction is valid and if it should be included in the ledger. In those ledger systems, the validators gets reward for helping maintain the ledger.
When your Bitcoin full node receives a transaction, your node will check through all the protocol requirements. This includes verifying that the inputs consumed in the transaction have not been spent in the past (i.e. no double spend), there is a valid signature that unlocks the bitcoins, inputs are greater than outputs as so forth. You can find a detailed list of the transaction verification rules here.

Does the Engine verify everything what is coming thru and i just have to pay for Power, Online Time, Memory and so?

That is correct. As mentioned above, when Bitcoin Core will receives a broadcasted transaction, it automatically verifies it against the consensus rules to determine that they are valid. Incorrect transactions are discarded and not relayed to other nodes. You only need to have your machine running with the software and it would take care of it.

Why my Budget didn't move a Single Satoshi up or down

In Bitcoin, only the miners get the block reward and the transaction fees associated with it. A full node's job is to ensure that the block which the miners have mined conforms to the protocol requirement. If say a miner turns malicious and mines a 'fraud' block, the full nodes connected to the network will reject that block and will not relay it further. Other miners also assume that the nodes on the network are honest and do not build further on the 'fraud' block mined. Thus the malicious miner not only loses the block reward and transaction fees, but also has spent his electricity and mining power to waste. Thus full nodes play a very significant role in the Bitcoin network to ensure everybody is acting in an honest manner.


Why Does Bitcoin Core Use Autotools? Why does Bitcoin Core use Autotools instead of checking a Makefile into source?

Because checking for compiler features, without Automake/CMake/Ninja/Bazel with only Makefile and C++ preprocessor is hard and unelegant.
And C++ preprocessor can't be used to make full-compile feature tests. If the compiler supports AVX256, a relatively new instruction set, that doesn't mean the assembler supports it too. There are "fail if can't compile completely"s in the autoconf file.


Why does "Hodl Hodl" not seem to... support Bitcoin? After listening to this podcast, I got extremely excited for Hodl Hodl: https://www.youtube.com/watch?v=hJe7LIZ6cdI
But then I went to their site and see this: https://lend.hodlhodl.com/offers/lend
Every single offer just talks about "Eth" or "DAI" or "Liquid" or "USDT" or "WBTC" or some other cryptic symbol. What?
I thought this was about lending Bitcoin? Not Ether or a bunch of "weirdcoins" which I don't have and don't want.
What am I missing now? It doesn't even let you select "BTC" in the list of currencies, so it's not just currently unavailable, but entirely unavailable.
What's said in the podcast and the actual webpage seem to have nothing to do with each other. I'm confused. What am I missing?
UPDATE: I've sat here for an hour and tried to register an account. Even when it eventually stops showing the CAPTCHAs, it just reloads the registration form. This is not a real website. It's just yet another vaporware/scam. Sigh.

It's not a scam. It doesn't allow lending Bitcoin, you are correct. When it says it supports Bitcoin, it means it allows you to use Bitcoin as collateral for a loan.
For example, if you want to borrow USDT, you'd be allowed to post an appropriate amount of BTC as your collateral, receive USDT, then when you pay back your USDT loan, you receive the BTC you posted as collateral back. If you default on the loan, then the lender receives the BTC you put up as collateral.


Does an increase in hash/s decrease the time it takes to obtain a block or does it increase the possibilities of solving one? I am a total noob, and I've been reading the wiki for a long time and have yet to understand the basics... My question here is that if I were to mine at 100GH/s (example), is it guaranteed that I would find a block after a determined amount of time? Or does it just increase the possibility that I am the first to find it?

Since solving a block is a probabilistic math problem, having more hash power will increase the probability that you will find the right hash and solve the block. You cannot be 100% sure of the estimation given by the profitability calculators.


What is impact of the possible nitwit fork on August 1? Will it double the coins I have? If the Nitwit proposal is activated at the end of July then as I understand a hard fork will occur because miners and nodes that continue using the old software will generate blocks in the old format, but those blocks will be ignored by nitwit clients, and vice versa. So, basically there will be two chains.

If that happens and I transfer some coins, how is it decided which chain the transaction occurs on? Can I double spend my coins, once on each chain?

No, all clients will be compatible until the HF and will mine one chain.

If SegWit2x reaches 80% support during a 336 block signaling period, it means that the SegWit softfork locks in and will activate another 336 blocks later on all SegWit2x clients. Those clients will then, upon SegWit activating, automatically turn on bit1 signaling to assist the Core BIP141 clients in reaching the 95% threshold they require for their own SegWit activation.

Then, exactly 12,960 blocks (~3 months) after SegWit activates on the SegWit2x clients, the SegWit2x 2MB hardfork will automatically activate on any/all nodes that are still running SegWit2x at that time.

That hardfork, if it maintains 75+% of the hashpower at the time of its activation, will force every other node in the entire network to update to SegWit2x (or SegWit2x compatibility), or be forked off the network.

As a normal holder, you can just sit back and watch all of the above. You may wish to pay attention to the SegWit2x compatibility of your chosen wallet, and adjust accordingly, but otherwise you're mostly safe throughout this entire ordeal. (You can always import your keys into a SegWit2x-compatible wallet later).

If you run a node, however, you will soon need to decide whether or not to switch it over to SegWit2x before, or immediately after, the hardfork.
The code for the SegWit2x hardfork is actually rather simple.
It involves two fairly straightforward variables that act as activation triggers (~3 months, or 90x144 blocks, after SegWit activates):
BIP102active and fSegwitSeasoned.

As well as two variables that actually enforce the hardfork changes (increase the block weight settings):

MaxBaseBlockSize and MaxBlockWeight.

That's it. There are a few other small changes to other lines of code that are meant to account for the signaling and size changes, as well as a few new tests, but everything else pretty much stays the same as Core's 0.14.1.

So, what does this mean for "blocksize" and throughput in the real world?
With Core 0.14.1 and SegWit2x softfork:

Base Size = 1,000,000 bytes.
Max Block Weight = 4,000,000 bytes.
Real-world block size results = ~2MB.
Transactions: 4,000 - 5,000 per block.

With SegWit2x 2MB hardfork:

Base Size = 2,000,000 bytes.
Max Block Weight = 8,000,000 bytes.
Projected real-world block size results = ~4MB.
Projected Transactions: 8,000 - 10,000 per block.


How do nodes reach consensus on when the target is recalculated? Due to network latencies, some nodes may think they are at a different block height than the rest of the network. How then does a node decide if the target has been recalculated since that changes every 2016 blocks.

The target recalculation is not something that is broadcast or something that is announced to nodes. Rather nodes calculate the targets for each block according to a specific algorithm that only requires the blockchain data. It is based on the previous block's target, the block height, and the block timestamps. So each block's target is done completely independently from the network with the only information required being the the blockchain.

Since the algorithm for calculating the target is deterministic, each node will calculate the same difficulty for the same block heights given the same blockchain data.


OP_EQUALVERIFY Problem I'm making a full-service wallet, I already made the UTXOs selection algorithm and now I want to push the transaction hex bytes. It works when I push only a transaction with only 1 input, but if I try to push the hex from a tx I made with 2 inputs from the same account, I get this:

OP_EQUALVERIFY: non-equal data

Here is my decoded hex:

{
   "lock_time":0,
   "size":339,
   "inputs":[
      {
         "prev_out":{
            "index":0,
            "hash":"3a896625fce1f18ce4c3139863359631d5677cff4e4fd8dac25ca6327c0dadd8"
         },
         "script":"473044022070f3b03cca6a75038ffe150be347a97d0e07adc857cc93e245739db55e3a6d36022051eb72b21e35a5e7309e1864f00e1b107a5b5262d80b1128e9fb45fbe7971c7b012102bb05325000709d3a3d8063f9913777859b8fa30b83e4c4f981bb2d9781b7c91a"
      },
      {
         "prev_out":{
            "index":1,
            "hash":"436094120d4412c32b97738f9051a32a237c037abe31cafbdc8a02d16f2a659c"
         },
         "script":"483045022100da7abc59e24d2afea9219ee24d1f3df4e1b9a2efa154d9704ed903210abfdb40022015a8237d38e18f558172872af1aa5c244b38c3ad8f594463c0dcad18dbfcf5f5012102bb05325000709d3a3d8063f9913777859b8fa30b83e4c4f981bb2d9781b7c91a"
      }
   ],
   "version":1,
   "vin_sz":2,
   "hash":"c5991f9f044f9d829fc01eeda76f36a514271270f9f891ea7b584f504ed404ea",
   "vout_sz":1,
   "out":[
      {
         "script_string":"OP_DUP OP_HASH160 7ff85ee854794422531b7b5c3d380c5f50011a4e OP_EQUALVERIFY OP_CHECKSIG",
         "address":"1CfeMTtDP9HNjc8vsuuHGgUfABexvW5Qkf",
         "value":350000,
         "script":"76a9147ff85ee854794422531b7b5c3d380c5f50011a4e88ac"
      }
   ]
}

Links for the transactions being used:

https://blockchain.info/tx/3a896625fce1f18ce4c3139863359631d5677cff4e4fd8dac25ca6327c0dadd8
https://blockchain.info/tx/436094120d4412c32b97738f9051a32a237c037abe31cafbdc8a02d16f2a659c

My address is 1FebYgpxQ1exSNdJENkbmNPmSfsiP3kZiT.

And my code using the BitcoinJS library is the following:

key = bitcoin.ECPair.fromWIF(privatekey);
var tx = new bitcoin.TransactionBuilder()
var sum_outputs = 0;

var input_utxos = defineInputs(utxos, amount);

for(var a = 0; a < input_utxos.length ; a++){
    tx.addInput(input_utxos[a].tx,a)
    sum_outputs+=parseInt(input_utxos[a].amount);
}

tx.addOutput(to, parseInt(amount));
var change_amount = sum_outputs - parseInt(amount);
if(change_amount > 0) {
    tx.addOutput(from, change_amount);
}

for(var a = 0; a < input_utxos.length; a++) {
    tx.sign(a, key);
}

result = tx.build().toHex();

console.log(result);

So my questions are:

Why is this working with 1 input from my address and not for 2 inputs?
How can I correctly sign the second input that I assume is the cause for the error?

So... I found out what was wrong. The problem was in this part of the code when i was adding the inputs. I was adding an index to each input based on which number of input it was.

for(var a = 0; a < input_utxos.length ; a++){
    tx.addInput(input_utxos[a].tx,a)
    sum_outputs+=parseInt(input_utxos[a].amount);
}

but the index i was supossed to send was actually the index on the transaction outputs. so it had to be like this

for(var a = 0; a < input_utxos.length ; a++){
    tx.addInput(input_utxos[a].tx,input_utxos[a].n)
    sum_outputs+=parseInt(input_utxos[a].amount);
}

The index was gettable from the api that provided me all the utxos for an account. In this case, it was called n and was inside the transaction object itself.


Why do we often see 2 blocks mined within a few seconds of each other? This seems to happen far more frequently than one would expect from a Poisson distribution with a ~10 minute mean. Am I just bad at statistics or is something else going on?

is something else going on?

Maybe.

AFAIK Mining nodes don't synchronize time. Timestamps in blocks are not accurate. You cannot tell the elapsed time between two blocks by looking at timestamps in those blocks.


I have an old blockchain wallet and a .txt file of 43 words, but the site wants 12 words? I have a wallet.aes.json file and a .txt file that contains 43 random words. They were both made within minutes of each other back in early 2014, and my confirmation emails from blockchain are also within minutes of these file timestamps. I also have a wallet ID from blockchain. Blockchain wants a recovery phrase of 12 words, and won't accept my 43 word phrase. I'm not sure what I can do to translate these 43 words into something that will let me into this wallet.

I figured it out. You can input legacy phrases here
https://login.blockchain.com/wallet/forgot-password
It spits out your password and wallet ID. I logged in. It's an empty wallet :(


Why is there no forced signaling during the LOCKED_IN phase of BIP 8(LOT=true)? Why is there no forced signaling during the LOCKED_IN phase of BIP 8(LOT=true)?
During the MUST_SIGNAL phase of BIP 8(LOT=true) a threshold of miners have to signal. The next phase after MUST_SIGNAL is LOCKED_IN. Signaling in the LOCKED_IN phase is recommended rather than mandatory. Why?

The state transition diagram of BIP 8 is here.
The specific change you refer to was made in this BIP PR by AJ Towns. Once we move into the LOCKED_IN phase of BIP 8 the soft fork is definitely going to activate at some point and so any requirement to signal is unnecessary. The MUST_SIGNAL phase makes it clear to the network that signaling is being enforced by the network. In the LOCKED_IN phase (which only begins after a difficulty adjustment period, 2016 blocks, where the threshold of signaling has been met) it is clear to the network that the soft fork rules will be enforced in future.


Address Public Private key verification Apologies if this question has been asked before, but when a bitcoin client wishes to send funds to an address, does the bitcoin protocol force the client to verify that the address has a corresponding private key?

For example, I am given an address and I want to send a btc to this address, before I am allowed to authorize this transaction does the bitcoin protocol force me to verify that the address can decrypt a message encrypted from its public key?

No, there is no enforcement that a private key exists.

However, due to a Bitcoin address including a checksum, it is very unlikely for the client to create a transaction when for an address with a typo, paste error, or other erroneous data.  There are addresses that will pass the checksum test in which, presumably, no private key exists. 1BitcoinEaterAddressDontSendf59kuE is, in all likelihood, one such address.


Government Taxes on Bitcoin in India What is the tax regulation for Bitcoin in India? If I make profit out of Bitcoin, what percentage will I have to pay to the government?

Most of the Indian bitcoin businesses go by the analysis from Nisith Desai and Associates:https://www.zebpay.com/wp-content/uploads/2016/04/Bitcoins.pdf

Bitcoin is unregulated in India(not illegal or legal) and only points of dealing with the sovereign currency(INR) are taxable. Rules vary depending on if you mine, earn, buy, invest, sell or spend your coins and also with the parties in the deal.


BTC Purchase - How To Invest For Capital Growth I joined coinbase, do I trade, or do I just leave the BTC in my coinbase wallet, if the market price go's up, nothing for me to do, just hold the coin in my wallet and BTC go's up in price, my BTC in my wallet increases as well?

You should not hold your coins in your coinbase (or any other exchange for that matter) account for extended periods of time. If you are only looking for a long term investment, you should transfer all your coins off of the exchange.

If you are looking to participate in higher frequency trading that involves day-to-day trading activity you should set a side a certain amount of money (or BTC) to do that with and leave only that much on your coinbase account at a time. The main "base" of your holdings should be taken off the exchange as soon as it is available and stored by you in paper storage or some sort of secure wallet that you have complete control over. If you store your BTC in keys that you alone control, you can rest assured that it is as secure as the entire bitcoin network itself. If you leave them on coinbase you are trusing coinbase with your money, and although coinbase is a "reputable" entity in this space, their future actions are totally unpredictable and you may not be protected by a justice system in the event of your funds being compromised


How can someone lose funds in Lightning Network? In Bitcoin once you own a private key associated with an address that has bitcoins on it, your funds are theoretically safe forever.
But on the Lightning Network, I see that once you send bitcoin to an address there, your funds can somehow disappear. What is the difference with Bitcoin and who or what owns the Bitcoin once they are there?

The main difference is that Bitcoin in lightning network channels are in 2of2 multisig wallets. You own a key and your channel peer owns the second key. Your funds are "safe" because you have pre-signed transactions that spend from that multisig wallet (similar to an offline signing of a transaction). As soon as you keep those pre-signed transactions, your funds are safe (technically you need to also keep some state information to sweep the outputs of those transactions). Apparently it is harder to keep several presigned transactions with a little state in comparison to just a private key.


Can a core wallet coinbase-transaction (generation transaction) be moved intact to a net new core wallet? Can a core wallet coinbase-transaction (generation transaction) be moved intact to a net new core wallet?

Wanting to go through cautious steps to claim BCH but, I hear a BTC coinbase-transaction when still 'whole' can be worth more when sold 'whole' than the sum of the BTC in said coinbase-transaction if divided up.

In v0.14.2 bitcoin core wallet, is there a way to move a coinbase-transaction intact/whole to a net new core wallet (so it remains worth more as noted above)? Source wallet does also contain some fractional BTC that can be used for fee.

No. Any transaction that you make will make it "not whole". i.e. the "coins" move to a different output. You cannot move any coins without making a transaction.


Private key only wallet for Bitcoin Core regtest I'm running a private regtest network on GCP. I generated a list of 2000 vanity testnet addresses ordered sequentially from prefixes mooo1 to n2ooo with their respective pub/priv key pairs, and to prevent complications, I want to only have one private key for each node (change in outgoing transactions are sent to the original address). Because there's no security concern in my setting (it's just a performance test, no money or attacker is involved), I want to make each bitcoind instance only use a single private key for all transactions, and not generate new addresses through an HD wallet. This is because viewing transactions is much more streamlined. I can tell which node is sending bitcoins to which other node, and diagnose issues more easily. Is there an option in bitcoind to only use a single private key?

No, there is no such option.

You can do what you want with the raw transaction RPC interface (createrawtransaction, fundrawtransaction, signrawtransaction, sendrawtransaction), though.


Is there a comprehensive list of Gateways' IOUs and fees associated with using them? I am looking for information about the various IOUs issued by Ripple Gateways and what fees are associated with using them - namely fees to get the IOUs and transit fees.

There is no official list of Ripple Gateways because there is no such thing as an "official" gateway. Anyone can operate one without registering anywhere (other than as required by local laws in their jurisdiction). That hinders the creation of any kind of comprehensive list.

There are a few people that attempt to keep somewhat comprehensive lists but their list criteria for inclusion may differ or they may not hear of some new gateway for a while so I think they best you'll ever be able to do is to have a list of list of gateways.

Some places that attempt to list gateways:

DannyM's bitcointalk.org post, All Things Ripple (mostly up-to-date, lists all kind of niche gateways not listed elsewhere)
Ripple Gateway sub-forum (only indexes gateways discussed on the forums, does not claim to be exhaustive)
Ripple Federation has a Ripple Business Listing that includes a Gateways and Exchanges setion
The International Ripple Gateways Association's gateway list (they have some arbitrary requirements to join and don't actually police their members yet)

Of these, the only one I know that explicitly list the fees (or provides links to where the fees are listed) is the Ripple Gateway sub-forum topics.

The Ripple internal transfer rate for any issuer can be queried with the account_info API. The other gateway fees (for redemption, issuing, etc) are probably best determined by going to the fee page of the gateway's website.
Some other basic per-gateway information (such as issuing and hot wallet addresses) can be retrieved in a computer readable form from the sites's ripple.txt file, usually available from https://gateway.domain.name/ripple.txt.


Bitcoin core crash during IBD I've been running bitcoin core on an android device (nexus 5x) and emulator, and sync on testnet always fails at around 3% progress

the last thing logged is

“pre-allocating up to position 0x900000 in rev00006.dat”

core crashes and when restarting the sync process never restarts getting stuck at

“Failed to open mempool file from disk. Continuing anyway”

Prune is set to 550mb and the device has 2gb ram but 70% seems to be taken up by the OS

Is this issue caused by a lack of ram? Or likely something else?

From my own experience, running ABCore on a Nexus 5X, Android is too eager to kill processes that use a large amount of memory on systems with less than 3 GB.


reorg a bitcoin transaction does anyone here have btc reorg full concept documentation that can be seen online?

also i wonder if a specific block can be reorged?

or all the blocks thats after the transaction must be reorged?

for example the guy who lost 8,999 BTC in 2011.

can the miners help him now to reorg his block to get it back?

or they have to re-un-mining all the blocks they did between 2019 and 2011 to do that successfully ?

A blockchain is a chain.

Each block is a link in this chain, that depends on the previous link (block) by definition.

If to change block N, all blocks from N until now must be mined again as well.

Moreover, if you want to alter a specific transaction, you are limited to only removing it if you do not hold the key(s) used to sign the transaction. If you wish to perform an alteration that changes where the BTC is sent, you must not only mine the entire section of the chain again, but also hold the private key(s) involved in that transaction to produce an alternative, valid tx.


Running multiple bitcoin instances on same server system I wish to run multiple instances of bitcoind on my server to support highly read intensive RPC applications.

Following links:

how to run multiple bitcoind node on one server?

Running Multiple Full Nodes on one Host

Is it possible to run more than one client instance on a machine?

How do I run two instances of bitcoind on the same linux machine with different conf files?

suggests that by using different conf file and data dir we can run multiple instances.

However, my doubt is that since in each case, we are specifying different config file and data dir to same binary bitcoind, e.g.

bitcoind -datadir=./bitcoinNode1/ -conf=./bitcoinNode1/bitcoin.conf
bitcoind -datadir=./bitcoinNode2/ -conf=./bitcoinNode2/bitcoin.conf
bitcoind -datadir=./bitcoinNode3/ -conf=./bitcoinNode3/bitcoin.conf

Does same single binary bitcoind is going to handle request for all instances (bitcoinNode1, bitcoinNode2, bitcoinNode3)? In such case load will be on single binary and I have a doubt for performance gain.

Or is it better to create different binaries bitcoind1, bitcoind2 etc. for each config+data_dir combo?

Thanks.

The provided approach is correct.

A binary itself does not handle any requests. When you run bitcoind with separate instances of the config and data directories, the system will create multiple instances of the bitcoind program to execute. Each of these instances is a fully independent bitcoin node, and has no relation to any other instance running on that machine.

Copying the binary will make no difference.


Most up-to-date stats Where are the most realtime (up to date) stats for exchanges like mtgox? For basic stats like exchange rate and volume, what is the best, average, and worst-case reporting delay and what's the URL?

I find http://bitcoincharts.com to be of high quality.


How many correct hashes are there giving a difficulty? I asked a question about mining difficulty in this SO post, Nate explained that the estimated total amout of hashes being calculated to date is 100000000000000000000000000 which is about 0.0000000000000000000000000000000000000000000000001% of the total number of possiblilities.

This brings up my question: If all of the computing power to date has only calculated a tiny small amout of all the possbilities, how can miners still earn their reward every 10 mintues? Does that mean the number of correct hashes (i.e. hashes less than the target) is also large so that bitcoin rewards are given out frequenlty?

Yes, there are a lot of hashes with low enough values to be acceptable. Precisely, there are target + 1 hashes which are acceptable.

The target varies over time and is adjusted every 2016 blocks (called a "difficulty period") so that with the then-current hashing power of the network, the average block time of the next difficulty period would be 10 minutes.

About every block explorer should be able to show you the block hashes. The hash of the current block (block 453794) is

0x0000000000000000006ec06a9ae920278c462a565cd8f31ea87acaa05e5fbafa

You can see this in the table of the block explorer of your choice:

https://blockexplorer.com/block/0000000000000000006ec06a9ae920278c462a565cd8f31ea87acaa05e5fbafa
http://blockr.io/block/info/453794
https://blockchain.info/block/0000000000000000006ec06a9ae920278c462a565cd8f31ea87acaa05e5fbafa
https://www.blocktrail.com/BTC/block/0000000000000000006ec06a9ae920278c462a565cd8f31ea87acaa05e5fbafa

The difficulty cannot be shown by all block explorers, but by some. It currently is 440779902286.5892. The difficulty merely is an easier-to-read version of the target. You can learn more about it on https://en.bitcoin.it/wiki/Difficulty.

I haven't calculated the current target but it got to be at most

0x0000000000000000006ec06a9ae920278c462a565cd8f31ea87acaa05e5fbafa

because otherwise, the current top block wouldn't be a valid block.

Every hash smaller than that is also accepted. Note that the representation of the hash in in hexadecimal which is the most common way of representing hashes.

You can just ask WolframAlpha what that number is in decimal. It's this monster:

10607898375488084905905799981068947599790252823802788602

Because 0 is also valid, there are at least

10607898375488084905905799981068947599790252823802788603

acceptable hashes.

Or in a more sane notation:

1.06*10^55

For comparison: You're probably made up of somewhere around 7*10^27 atoms and Earth's circumference is about 8.01*10^11 times the width of a human hair. So, yeah ... quite a few options to choose from.


How does consensus protect from lying about transactions? I'm really new to the whole concept of blockchain.

I do understand how consensus protects from changing past blocks and allows to keep a clear and valid blockchain, but I am having a hard time trying to wrap my head around fake transactions.

Let me explain. As I understand it :

Nodes in the network produce transactions.
They are repeated all across the network
At the same time, some nodes try to mine a block.
When someone resolves the hash, they can create their block.
The block is accepted by everybody on the network as they can immediately check Proof of Work (via the hash + the data)

Ok so this basically means that everybody follows the consensus (otherwise, everything said by anybody else would be garbage to a Node, and the other way round : we would have an isolated node). But how do they know that the transactions themselves written in the new block are correct ?

For instance, let A and B be two accounts. What prevents a node from randomly saying "B gave n bitcoins to A", and that information being completely false ? B would obviously benefit from doing that.

Maybe I don't understand how consensus is enforced in nodes themselves as well... is everybody running the same "program" ? Is it something in the protocol itself ? Does the consensus "know" when a transaction cannot be made for some reason ?

Thanks for your help

You can think of a bitcoin address like a machine that produces locks and a bitcoin wallet like a machine that produces unforgeable, labeled keys.

Say Alice received 1 bitcoin from Bob and wants to send it to Charlie. If Alice has 1 bitcoin to send, that means there is 1 bitcoin that is locked with a lock from her lock-making machine.

When Alice wants to send that 1 bitcoin to Charlie, she must have his address. She uses his address as a lock-making machine and makes a lock that only Charlie can unlock. She feeds this to her key-making machine and makes a key to the lock that only she can make a key to but labels it with the lock she got from Charlie's lock making machine.

This new key only opens the 1 bitcoin Alice will send to Charlie, and only Alice could make it. The attached new lock can only be opened by Charlie, since only he has the matching key-making machine.

You consider someone to have "sent you a bitcoin" if they locked it with a lock that only you can open.

So, a block that contains invalid transactions is itself invalid and ignored. You can only form valid transactions that transfer bitcoins with the appropriate keys or the transactions are invalid.

This might make you wonder what you need consensus for at all. And the problem is that Alice could maliciously make multiple keys that open the same lock, transferring the same 1 bitcoin to both Charlie and Dave. We need consensus to agree which of a set of conflicting transaction, each individually valid, we can rely on.


Buying big amounts of Bitcoin for cash in person Presumably, I want to buy Bitcoin in person somewhere in Europe. I need very big amounts, say, 1K BTC, and I am willing to pay in cash (EUR).

When I find potential sellers online or through friends, I ask them to prove they have access to these amounts of BTC by sending me 1 satoshi from their accounts or by giving me some other proof. However, they all say that they don't just want to show their BTC accounts as it's unsafe and ask for a video of my cash, which I don't want to provide first to anyone.

How should I approach it? How are these trades usually done?

For large purchases, you should look at OTC (Over The Counter) Bitcoin markets. Also known as "dark pools".


What's a good resource to learn how [technically] bitcoin works? What are some good resource(s) for learning how bitcoin works?

I can't seem to find any resources that are any more detailed than the basics - how you have wallets, the blockchain, confirmations, mining, etc. The source code for bitcoin is also a little beyond me.

What are some good resources that explain the maths behind bitcoin? i.e. things like:

How to mine bitcoin, step-by-step ('manually' - not how to setup cgminer or GUIMiner)
How to generate a new bitcoin wallet address
How to update the blockchain
etc

Take a look into the technical wiki pages: https://en.bitcoin.it/wiki/Category:Technical

For example, Technical background of version 1 Bitcoin addresses explains how Bitcoin addresses are generated, or the Protocol specification might help you as well.


ASIC Speed measurement Mining hardware manufacturers use "Hash rate" to define how fast the mining is with their ASICs, but do they mean 1 sha256 cycle speed or Bitcoin hash speed sha256(sha256(header)); ?

The usual interpretation of "hash rate" is the number of distinct block headers that can be tried per second.  So this should include the time needed to:

increment nonce value
increment extraNonce or other coinbase parameters and recalculate Merkle root, when needed (once in every 2^32 attempts)
compute two rounds of sha256
compare the resulting hash value to the target.

Of course the two rounds of sha256 are the slowest part of this process, by far.

As Raghav Sood says, there's no way to know if any particular vendor is actually following this interpretation, but it's so widely used that I'd regard anything significantly different as fraudulent.


Could not locate RPC credentials Error I am trying to follow the instructions in the following post:
Check status of daemon

When I try to run bitcoin-cli getblockchaininfo I get the following error:

When I look for the configuration file. It looks like it is not even there.

I am on Windows.

You're getting this error because bitcoind isn't running. Once it is, it will create an authentication cookie, and bitcoin-cli will be able to connect.

To start bitcoind from cmd prompt, type:

cd C:/Program\ Files/Bitcoin/daemon/

Press enter, then type:

bitcoind

And press enter.