How do I exchange one cryptocurrency (not BTC) to another (not BTC)? What if I want to exchange one cryptocurrency (not a Bitcoin) to another (not a Bitcoin). How can I do that? Do I need to exchange it first for a Bitcoin and then exchange a Bitcoin for the target currency?

I know there's something like Changelly or ShapeShift, but what if I want to do it manually, or is what I've described above what these guys do under the hood (that would suck so much)?

Exchanging means you are swapping one currency for another. That means you need to find someone who has the currency you want, who also is willing to swap for the currency you have. The purpose of exchanges is to make that 'finding' process easy, because lots of users meet on an exchange to swap their currencies around. There is no way to 'manually' convert one currency into another without swapping with someone, because each currency is different.


Sendrawtransaction error on Bitcoin Core Version 0.16.0 I updated my bitcoin core to version 0.16.0, previously I was using v0.15.1.
I created an application to send some BTC using listunspent -> createrawtransaction-> signrawtransaction -> sendrawtransaction
I got this error on v.0.16.0 while using sendrawtransaction :

  64: non-mandatory-script-verify-flag (Signature must be zero for
  failed CHECK(MULTI)SIG operation)

But my app working normaly on version 0.15.1
What is actually going on on version 0.16.0 that makes my transaction error

I decoded my raw transaction, to see if anything is wrong, I am using BTC testnet

array:2 [
  "status" => true
  "result" => array:8 [
    "txid" => "261c30c9c167b079c45c5ea706617635eb477b9cb601b7c7addbd6fedc2c14d9"
    "hash" => "261c30c9c167b079c45c5ea706617635eb477b9cb601b7c7addbd6fedc2c14d9"
    "version" => 2
    "size" => 197
    "vsize" => 197
    "locktime" => 0
    "vin" => array:3 [
      0 => array:4 [
        "txid" => "d4fcae2238c7edde389c3e1d28ddd67570931c72982312fbae3292c6eb7b7620"
        "vout" => 0
        "scriptSig" => array:2 [
          "asm" => ""
          "hex" => ""
        ]
        "sequence" => 4294967295
      ]
      1 => array:4 [
        "txid" => "5e759bcccc5123e9fbad740b57a1571a5950e867619dfd4cbbe6786dd50ab054"
        "vout" => 0
        "scriptSig" => array:2 [
          "asm" => ""
          "hex" => ""
        ]
        "sequence" => 4294967295
      ]
      2 => array:4 [
        "txid" => "d1be0d65d5338c9bc4b51b14f6adee7f88e56d0f9625c92646e16aa86e7c6a71"
        "vout" => 1
        "scriptSig" => array:2 [
          "asm" => ""
          "hex" => ""
        ]
        "sequence" => 4294967295
      ]
    ]
    "vout" => array:2 [
      0 => array:3 [
        "value" => 1.0
        "n" => 0
        "scriptPubKey" => array:5 [
          "asm" => "OP_HASH160 7ba3562975f6203987c03b40dd84e010948af2e4 OP_EQUAL"
          "hex" => "a9147ba3562975f6203987c03b40dd84e010948af2e487"
          "reqSigs" => 1
          "type" => "scripthash"
          "addresses" => array:1 [
            0 => "2N4WxmhixnDF6x2gmJSjgoX28RMSd6oCaMr"
          ]
        ]
      ]
      1 => array:3 [
        "value" => 6.01032205
        "n" => 1
        "scriptPubKey" => array:5 [
          "asm" => "OP_HASH160 b449a4b595e856c16eba7d7168ac5fdcc552fbbf OP_EQUAL"
          "hex" => "a914b449a4b595e856c16eba7d7168ac5fdcc552fbbf87"
          "reqSigs" => 1
          "type" => "scripthash"
          "addresses" => array:1 [
            0 => "2N9gVqeSJnLKPGRJJa2gKXUPy5bT331sxNo"
          ]
        ]
      ]
    ]
  ]
]

I encountered the same issue, to resolve I resorted to starting the bitcoind daemon using the following flag:

  -deprecatedrpc=signrawtransaction

I am now looking for a better solution.


Adding an additional GPU for LTC mining I've just recently started litecoin mining on a kind of old AMD GPU.  My motherboard has space for 2 additional cards.  I'd like to drop in a new card specifically for litecoin mining, but...  I'm not sure if the two cards need to be identical.  Crossfire stuff is confusing me.  If I drop in a second card can it be top of the line and still have my old card do some work?

The cards don't need to be identical. Your mining software should identify each GPU and allow you to control/use each one separately.


How much money is being doled out in fees for every block right now? Every time I see a calculation of the profitability of mining taking in account your hardware and the number of Hash/s it does and subtracting energy costs and then the probability of finding a share and receiving 25BTC every block and so on... it never accounts for the money given in transaction fees (that will eventually be the only money given to miners when the stock of BTC reaches 21 million).
I'd like to make a more accurate estimate of how much money for MHash is actually being generated that takes the transaction fees into account. I can't find that info on Block Explorer. Does anyone have an idea of the magnitude of those fees?

There are some useful charts that show information about, amongst other things, fees per block.  Fees per block are currently trending downwards, but that is due to the additional hashing power coming on-line which means that blocks are being mined faster and so the average number of transactions (and hence fees) in an individual block is dropping.  Expect this to balance out sometime soon as the network takes account of the increased hashing power out there.

Right now, if you assume that transaction fees sit at around 0.25BTC per block you won't go far wrong.


Sharing ownership of coins via Multi-Signature transactions I wonder if it would be possible to use a script to share ownership of an UTXO between 2 or more people.

1 <A pubkey 1> <B pubkey 2> N OP_CHECKMULTISIG

That would let every owner be able to spend these coins without needing to ask the other ones for permission.

This is at the moment a valid standard script that is accepted when it is being sent to the Bitcoin network.

But i am asking myself if this could be used to trick people?

If i pay with such a transaction with the receivers public key and my one in the script, i would still be able to spend these coins afterwards. And the receiver would not even notice that i am able to steal back my paid coins. Is this a realistic scenario?

Generally wallets don't recognize payments to random outputs, even if they're able to spend from them. In situations where multi-signature outputs are used, they're generally part of a scheme that the wallet knows about and participates in (for example 2-of-3 multisignatures where one of the keys is in your phone, one in a vault, and one is held by the wallet provider; usually the provider signs transactions you ask them to, but you can also spend with just the vault key).

This avoids the situation you're describing.


Automatically buying bitcoins from SEPA deposit I'd like to buy bitcoins via SEPA deposit automatically with a recurring schedule. To specify this with an example, I would like to purchase bitcoins for 100 EUR each month, at the current market rate, without manual intervention. For this, I can set up a recurring payment at my bank to a SEPA bank account. The manual way to do this at Bitstamp would be:

Start SEPA deposit at Bitstamp for 100 EUR.
Make a bank transfer to the given account with the given message.
Wait for funds to appear at Bitstamp.
Use instant order to purchase bitcoin for 100 EUR (converted to dollars).
Wait for the transaction to complete (may take days if market fluctuates).
Withdraw bitcoin from Bitstamp to a given address.

I am not bound to a single exchange, any one of them will do as long as they roughly follow the current market. I am not afraid to run a server, or to create my own program using an API to do this. However, I am not willing to use screen scraping, because I would wish for this to run with minimal intervention and such an approach would seem too error prone. I am also obviously not able to affect my bank, so the best I can do is to have a recurring payment with a fixed message/reference number each month.

Is there an exchange or combination of services that will let achieve the above automatically?

There is a website called  Bitcoin Magnet that does exactly what you require. Check them out, they have good reviews. They convert a bank transfer containing your reference code into bitcoin (using Bitstamp) and send it automatically to your desired bitcoin address. You can therefore set up a standing order to buy on a regular basis. UK only.


What should I consider when deciding to whether or not to mine? I go here
http://www.alloscomp.com/bitcoin/calculator

I put in the amount of hashing power I am willing to purchase, EG: 100 GH/s. It tells me I will make $2,094.25 a month. I am aware that the exchange rate changes, difficulty rate rises. But what prevents me from making at least $1500. They say joining a pool is best, but even if I go it alone, what is the thing that will prevent me from making a reasonable amount of money based off of the information in this calculator. I cant be as simple as buying a miner and letting it run all day.

You really need to take into account some important factors, which that calculator is missing:

The current rate of increase in difficulty
The expected delivery of the mining hardware
The cost of the mining hardware
The cost of running the mining hardware (electricity cost)

I highlighted 2 of the most underestimated factors normally ignored by new miners.

Many mining hardware orders can have significant delays in shipping, due to high demand and low production volume. Sometimes you can wait months for a delivery, by which time the mining difficulty raised so high as to make the hardware unprofitable, even with the rise in BTC/USD price. This is especially true of new hardware pre-orders, be very careful about those (don't believe the expected shipping date).

I would recommend that you use this calculator instead.

Make sure you fill-in a realistic hardware lead time (1 unit for every 12 days wait).

Do your research otherwise you could end up not breaking even.


Transaction unconfirmed over 30 hours! I've bought bitcoin through bitcoin ATM machine several times, and this time was different that the transaction has unconfirmed for over 30 hours, usually transactions through the bitcoin ATM machine was just few minutes.

Can you guys please me and have a look at the transaction ID?Thanks!

https://blockchain.info/tx/41d3d5b80a912a566c5f842dc4e945f40c8b99291f1bf9e777616673dc7186a8

brother -
you are transacting almost SIX BTCS with a measly fee of .0002

THAT is why its taking such a long time and will continue to take a long time


how to be a maker for either bid or ask orders on bitcoin exchanges? Using a random coin as an example, if the last price is 1.08999944 how can i chose either a buy or sell price that will be a valid 'maker' price ? Can i just bump the price by one Satoshi i.e. 1.08999945 and put a buy.. making it a maker order and take advantage of lower fee ?

Looking at various coins order books there seems to be a lot of open orders so to make a valid maker order do i need to first query the order book for open orders and then find a gap at a price i like and then place the order ?

I understand the maker is

 ... maker fee if the trade order is not matched immediately against an order already on the order book, which is adding liquidity.

I'm just not sure how you know in advance of placing the order that it will not match an open order ?

Thanks
fLo

In general, you can't know for certain.

Let's say you want to buy.  You will be a maker if, and only if, your price is below the lowest price of any sell order (the Ask price) at the instant your order is placed on the exchange.  If your price is above the Ask, it will be instantly executed and you are a taker.  (At least, up to the extent that the open sell orders are large enough to fill it.  If the sell orders at or below your price do not fill your entire order, then the rest of the order remains on the book.  The exchange might charge you the taker fee only for the part that executes immediately, and the maker fee for the rest; you'd have to check their policies.)

You can check the order book and try to name a price above the current Ask.  But there will always be some delay between the moment you check the book and the moment your order arrives at the exchange, and it's possible that further sell orders arrive during that window of time.  So you can never be sure.

(It's possible that the exchange might have an option to only enter your order if it would be a maker, and to cancel it otherwise.  You'd have to ask if they offer such a thing.)

Note that the Last price is irrelevant to all of this.  It only gives the price of the last order that executed.  If additional unmatched sell orders have arrived since then, it's entirely possible that the Ask price is below the Last.

If you want to sell, then everything is reversed: you are a maker if, and only if, your price is above the highest price of any buy order (the Bid price).


How does a client know it is connected to the right P2P network? Global botnets of "pwned" machines exist. Hypothetically, such a botnet could be configured to look a lot like the Bitcoin peer-to-peer network.

It could even have a long (fake) block chain, full of fake timestamps showing years' worth of history where the difficulty just never got very high.

My question is simple: How does the Bitcoin client know it is connected to the "real" Bitcoin P2P network and not to an impostor? That is, what mechanisms does it use to make this identification with confidence?

The more such mechanisms you identify, the better your answer is, in my view. Thanks.

There's a list of hardcoded blocks in the bitcoin client: https://github.com/bitcoin/bitcoin/blob/master/src/checkpoints.cpp

However, you present an entirely valid attack. If I can control one DNS seed and DDOS the others, I could cause new clients to only connect to my network.


Is it possible to verify or audit an exchange to determine how much bitcoin they have on deposit? Is it possible to verify or audit an exchange (for eg. mnt gox) to determine how much bitcoin they have on deposit?

For example, they could publish one or more bitcoin wallet addresses and by examining the block chain the total amount of bitcoin held could be verified.

If they want to publish this information, it's certainly possible.

If they don't, nobody really knows. They have at least one Bitcoin address for receiving money from each customer, and probably many, many more. Knowing and tracking all of them would be impossibile.


Get scripthash for known scriptPubKey in PHP I have to query addresses in ElectrumX server. How do I generate scripthash for a known scriptPubKey in PHP?

Example address:

array (
  'isvalid' => true,
  'address' => '1MUz4VMYui5qY1mxUiG8BQ1Luv6tqkvaiL',
  'scriptPubKey' => '76a914e0ad60c897901128662623c500a4a6079e99cd3e88ac',
  'isscript' => false,
  'iswitness' => false,
)

I tried:

hash('sha256', hex2bin('76a914e0ad60c897901128662623c500a4a6079e99cd3e88ac'))

But it seems to be wrong.

I found the solution replicating https://github.com/janoside/btc-rpc-explorer/blob/master/app/api/electrumAddressApi.js

$scriptPubKey = '76a914e0ad60c897901128662623c500a4a6079e99cd3e88ac';

$addrScripthash = hash('sha256', hex2bin($scriptPubKey));
$re = '/.{2}/';
preg_match_all($re, $addrScripthash, $matches, PREG_PATTERN_ORDER, 0);
$addrScripthash = implode('', array_reverse($matches[0]));

print($addrScripthash);


Bittrex API rate limit Does Bittrex have a limit on how many requests I can do? I cannot find that info in their documentation.

I only find their Announcement from 2014 which says:

  Api requests will be throttled based on data intensity and resource
  utilization, calls will be eligible for throttling if they exceed:

  Low:  1 request per second

  Medium: 1 request per 10 seconds

  High: 1 request per 30 seconds

  The API documentation will be updated shorty to
  reflect the intensity level of each call. These changes are still in
  draft and we're looking for community feedback.

But it doesn't look like they put these limits live, and their API documentation doesn't say anything about it.

This question has been asked in the #api-developers channel of the Bittrex Slack Group a few times.

Here's the important fragment of the discussion with somewhat an answer to our question.

  July 2nd, 2017

Some user:
seriously guys.. the rate limit.. what is it..

bittrex-bill:
It varies by API call.
If you hit the limit, you are abusing it. If you hit the limit a lot, you risk getting banned :)
I dont have a clearer answer for you right now

Some user:
Is greater than 1 minute consistently 24/7 within an acceptable use?

bittrex-bill:
yes

That's it! I personally wish they would update the API docs with a clear and hard limitation, but for now, when we're writing code that is long-running, and executes in a loop, we should try to cap the requests around 1 request per minute per API method.


Is it possible to handle BCH transactions on Bitcoin Core wallet? I've installed Bitcoin Core on a server and it works well for BTC. I would like to know can I use the same server and platform to support BCH too?
I know that the addresses generated in Bitcoin Core are usable for BCH too. But how if I am able to handle BCH transactions in this machine, how can I differ them from BTC ones?

Thank you in advance for your replies.

If your BTC addresses aren't SegWit addresses, you can use dumpprivkey to extract your private keys and use them in a BCH wallet. You can import them to Electron Cash, which is a wallet software, or Bitcoin Unlimited/Bitcoin ABC, which are equivalents of Bitcoin Core. I'd advise against using BU/ABC and Core on the same machine, because both of them use the incoming port 8333. Besides, you might need to set datadir option otherwise they'd corrupt Core's blockchain and wallet databases.


Why is there currently no bitcoin package in Debian? Why is the bitcoin package currently not in Debian? And how to help get it back in there?

It'd make it a lot easier for more people to run a full node with this.

https://tracker.debian.org/pkg/bitcoin

Why is there currently no bitcoin package in Debian?

Your link also says:

  action needed

Problems while searching for a new upstream version                  high
2 security issues in sid                                             high
Depends on packages which need a new maintainer                      normal
The package has not entered testing even though the delay is over    normal
Build log checks report 1 warning                                    low
Standards version of the package is outdated.                        wishlist

  testing migrations

  excuses:

  Migration status for bitcoin (- to 0.18.1~dfsg-1): BLOCKED:  Rejected/violates migration policy/introduces a regression
  Issues preventing migration:
  Updating bitcoin introduces new bugs: #939608
  Additional info:
  Piuparts tested OK - https://piuparts.debian.org/sid/source/b/bitcoin.html
  241 days old (needed 5 days)
  Not considered

If you drill into the details you find security bugs such as CVE-2019-15947

  In Bitcoin Core 0.18.0, bitcoin-qt stores wallet.dat data unencrypted in memory. Upon a crash, it may dump a core file. If a user were to mishandle a core file, an attacker can reconstruct the user's wallet.dat file, including their private keys, via a grep "6231 0500" command.

I guess time needs to be spent resolving all the issues identified with the package.


How to create your own bitcoin mining software? Can we create mining software, if yes, how?

Yes, it is possible

Take an editor (notepad.exe is good one)
Write a program
Compile and test it
Thats all. Profit!


How do miners earn partial bitcoins? I know that the miner who has the hash matching with the bitcoin's root software gets to stamp the block and put it onto the blockchain (correct me if I'm wrong). Accordingly, that miner takes the awarded amount of bitcoins.

On the other hand, isn't there with a possibility of earning partial bitcoins (I see people calculating how much they can earn with their respective computing specs)? How does this happen if I can't find the hash correctly?

A miner must create a block whose header, when hashed, is numerically less than or equal to the target value for the block. Each block contains a list of transactions whose merkle root is included in the block header, and the list must have at least one transaction in it, called the coinbase.

The coinbase collects all fees of other transactions in the block (the difference between the sum of outputs and the sum of inputs of each transaction is its fee), and adds a subsidy, which was initially 50 BTC, but halves every 210000 blocks.

The coinbase can have any regular outputs like any other bitcoin transaction, as long as the sum of the output amounts is less than or equal to the sum of all fees in the block plus the subsidy. Usually, the miner will put their own payout address in the block template which they attempt to perform work on.

The potential for earning partial bitcoins is a system built separately from the bitcoin protocol, in which miners pool their computing resources to collectively attempt to mine a new block. The block reward is then distributed among the members of the mining pool according to the amount of work they contribute. This distribution can be achieved directly and without the need to trust a pool operator, by having each miner's reward being paid out directly as a coinbase transaction output.


How to access my bitcoin on a new wallet? Ok let me start with I am a novice and please excuse my ignorance(!) Thanks!

A few years ago I went to the bank and deposited cash to buy bitcoin. I had a wallet with a bitcoin address as well as a secure password which I wrote down (I am looking at it as I type). However the computer I used has since been replaced by a new one and I left my country to move abroad without installing the original wallet on my new laptop.

I do have a paper wallet saved but I really need to some advice on what I need to do to access my bitcoin on a new wallet and to see how much my bitcoin is worth.

Any help would be really, really appreciated.

Many thanks

to tool up how much it is…

…although its should not have changed much since back then )

you can easily look up the address if you wrote it down.

just replace with your address: https://blockchain.info/address/1C3RiLE1M5BsGHH5GDhTwjTmYquawd6aKj

and of course there are many other site that do the job of a "blockexplorer" if you need a term to search for.

prices you will find on market places and exchanges like poloniex or kraken.

to actually use the funds

you'll need a wallet software that can read your private key format and can either create a transaction to be transmitted or send it to the network directly. you will find a list to start with: https://www.weusecoins.com/en/find-the-best-bitcoin-wallet/ and some other places like the bitcoin wiki and other forums will give much more.

To convert private key formats you can use – for actual private keys with an offline copy – tools like e.g.

bitaddress.org (source)
iancoleman's BIP39 (source) – this is a good starting point to dive deeper as newer BIPs are implemented that enable you for usage of e.g. SegWit enabled addresses.

I cannot recommend you anything without knowing what is your device/operating system etc.


When do P2Pool Node Fees get paid? I have set up a node and been running for a few days now and a couple of payments have gone out form it which is good.

These payments are going to a coinbase wallet and there is a local wallet configured for fees and the fee is set to 5%.

I have had 2 payment come out of the system at around 0.002 BTC but no fee payments have been sent to the p2pool wallet.

Are they held to reach a certain amount or are they computed in a different way that on the payout amount.

Thanks.

Correct - you will be awarded node_fee percentage of the shares found on your p2pool.

Relevant lines of code: https://github.com/jramos/p2pool/blob/master/p2pool/work.py#L197:L203


Will the blockchain get too large? As the entire blockchain gets much larger, it will be impractical for ordinary users to maintain all of it. Will it be maintained by a diminishing number of powerful systems, and would that create an opportunity for collusion and fraud?

Clients do not need to keep the entire blockchain. There are going to be historical transactions that no longer have any coins associated with them. This means that clients could, today, purge a large chunk of the database.

This was mentioned in the original whitepaper:

  7. Reclaiming Disk Space

  Once the latest transaction in a coin is buried under enough blocks, the spent transactions before it can be discarded to save disk space. To facilitate this without breaking the block's hash, transactions are hashed in a Merkle Tree [7][2][5], with only the root included in the block's hash. Old blocks can then be compacted by stubbing off branches of the tree. The interior hashes do not need to be stored.


Automated FIAT Transfer to bank from Exchange is it possible to trigger an automated wire to a bank account with an exchange platform?

we do want to make a couple of transactions a day depending on the bitcoin trading price based on rule sets.

from our wallet --> send to exchange --> automated process to sell into EUR --> wire send to Bank

any ideas?

This would vary widely by exchange. The BTC transfer and trade can almost definitely be automated through most large exchange's APIs. Fiat withdrawals might be possible, but I don't recall seeing any APIs for that recently. Your best bet would be to contact the exchanges and ask about it, as I suspect it is a feature that is available "on-demand" for larger clients, and they might be willing to support you on it.


Help please recovering a wallet from a 17 word mnemonic phrase and other info 4 years ago I bought bitcoin and I have
a 17 word mnemonic phrase
an identifier
a bitcoin address
and what I believe is a password

Does anyone know how I can access this bitcoin?

Do you remember where you created the wallet?
I assume it was a legacy wallet on blockchain.info, if so you can recover your ID and password here https://blockchain.info/wallet/forgot-password .


Asset creation on cryptocurrency/blockchain I have a question regarding the creation of a blockchain application.
In bitcoin its predetermined before the genesis block is even created, to only release a limit of 21 million bitcoins. Examples such as ripple and ethereum also release the amount of coins they have in their blockchain on creation.

Is the possibility to determine asset on a blockchain only available at the creation?

Lets say for example I want my blockchain to have 1000000 monkeycoins as assets, but 4 years later I want to add another 500000 monkeycoins and maybe 5 years after that another 500000.

Is it a must to say I want 2 million coins in assets on creation or can I add a random amount as long as everyone in the network agrees on the creation of the asset?

That depends on the protocol you are using to create the assets.

For instance, with Colu's Colored Coins protocol (a protocol that works on top of Bitcoin), the issuer of an asset explicitly specifies if the asset is reissuable in the future or not (when he first issues the asset). If the asset is issued as locked, then even the issuer can not reissue more units of the same asset in the future. On the contrary, if the asset is issued as unlocked, then the issuer is able to reissue more units in the future. Note that if the asset is unlocked, then the issuer alone may decide to create new units of the asset (there is no need for the "network" to agree on this).


Will a USB mining device use my computer's processing power? I know that if I use Pooler's CPUMiner it will use all my computer resources for mining purposes.

What if I use one of those Butterfly Labs 5 GH/s SC devices will it use 100% of my CPU power or the device does all the hard work?

If you are using dedicated mining hardware, then CPU is only used for dispatching work to ASIC and sending the result back to pool. Therefore, CPU usage in this case should be very small, certainly not 100%.

Own experience: Linux, cgminer, 2*5GH/s ASICs: the miner uses about 1 minute of CPU time per 24 hours walltime, much less then bitcoin client running mostly in background.


Is the authentication system of the Bitcoin  SMS service PHONECO.IN adequate? @osmosis made me aware of PHONECO.IN, which makes it possible to send Bitcoins via SMS. My question is whether their authentication system is adequate. From their website:

PhoneCo.in is designed to be easy to use and secure.  The server which processes your text message communicates with a separate server processing the bitcoin transaction.  The data from your text message is sent using AES-265 encryption and is signed using HMAC-SHA1.  This combination of security measures makes it very difficult to initiate a PhoneCo.in transaction in any way other than using a cell phone, as any requests to the bitcoin server must originate from the text message processing server.
We require you to reply with a 5 character confirmation code within 5 minutes when sending a payment.  This is necessary to verify that your phone has initiated the payment request (and that someone isn’t spoofing your phone number when contacting our server).  Spoofing another phone number is illegal in the United States and punishable with fines up to $10,000.  If you receive a confirmation code for a payment you didn’t initiate, contact us so we can help track the offender.

I think it is probably adequate for its intended purpose but not adequate for managing large balances.

The biggest problem is the risk of compromise or theft of your phone or phone number. Anyone who obtains physical access to your phone while it's unlocked (or who is able to unlock it) can look through your text messages and can transfer your Bitcoins to themselves. The Bitcoins are effectively completely untraceable and permanently lost at this point.

The lack of a way to secure your account with PhoneCo.in without your phone is, in my opinion, a serious problem. What if I can't find my phone but might just have left it a friend's house? Am I supposed to disable my phone with my provider only to re-enable it in twenty minutes when I find it? Or am I supposed to have a 20 minute window in which someone can break into my phone and steal my Bitcoins? (Will a mobile company shut off your phone immediately even at 3AM?)

If your phone is lost or stolen, you have to have it disabled immediately -- even if it's locked, even if you might find it in a few minutes.

Another problem with the accounts only being associated with a phone number is that I have to trust my mobile provider. If I lose my mobile account for any reason, I lose my coins too. If my phone number is erroneously transferred to someone else, they get my Bitcoins or at the very least, I cannot get them. If my mobile provider suddenly decides I broke some rule and they cancel my contract "for security reasons", how can I prove to PhoneCo.in that it's my account?

So, the service is simple. It's convenient. And its security is about comparable to a physical wallet (that can also be lost or stolen).


How can nodes verify the transactions before miner ? Give me easy explaination If Alice sends 2 Bitcoin, it goes to the nodes to be verified. If nodes are verifying, then what do miners do? I read somewhere that if miner changes the transactions in a block, the block will be invalid. How can miner change the transactions in a block?

Contrary to popular belief, it is not the miners' job to verify transactions. Rather it is the job of the full nodes on the network to verify the transactions, and miners are a subset of that (i.e. miners are also full nodes). Rather miners only exist to establish the ordering of transactions, within certain restrictions.

Full nodes can verify transactions without them being a block and without mining a block because the process of mining does not alter the transaction. A full nodes merely needs to know the transactions that a given transaction spends from in order to determine whether the transaction is valid. Miners must do the same thing so that they only include valid transactions in their blocks.

What miners exist to do is to establish the ordering of transactions. They are not there to say that a transaction is valid. Rather what they do is, when given two transactions that conflict with each other, say which one is "first" and thus the one that everyone else should believe. Bitcoin uses a first come, first serve system, and miners are only here to say which transaction was first. The two conflicting transactions must be valid as transaction validity is a precondition for this conflict resolution.

  I read somewhere that if miner changes the transactions in a block, the block will be invalid. How can miner change the transactions in a block?

A transaction is just data. Anyone can alter data that they have. If a miner alters a transaction and includes it in his block, the transaction will be invalid and all full nodes on the network will reject it.


VirCurEx - Balance vs Available Balance So I have a VirCurEx account and I moved 1.5 BitCoins over to it... After the transaction was complete (like a day ago) I was checking and the website said "Balance - 1.5" which is correct but then for Available Balance it said "Available Balance - 0.74900001" or something close to that.

So I trade half of my bit coins in for other currencies (PPCoins, NameCoins, LiteCoins, etc.) and when I tried to trade more it wouldn't let me... Even though I have about .76 BitCoins left in the account (and I can withdrawal them if I want) the Available balance says 0.0001 (or something close to that, I'm not looking at it now)

Does anyone know what the difference is?

Figured out I had placed an order to sell half of my bit coins a while back and forgot about it... the order was still in effect thus rendering half of my stock unusable hahaha! All is well now!


How to store blockchain data If I wanted to imprint the blockchain data on a database, with the purpose of performing complex or just different than the RPC-based queries, how would I do it? Would I have to go for a relational database or a NoSQL one? Eventually the database would be filled with hundreds of millions of records, which databases would perform well (respond quickly) to these gigantic numbers?

If you settle for a relational DB you can try BitcoinDatabaseGenerator.
https://github.com/ladimolnar/BitcoinDatabaseGenerator/releases
Sources and wiki: https://github.com/ladimolnar/BitcoinDatabaseGenerator

It may take you a few hours (it takes me 90 minutes but that will vary depending on your hardware and configuration) to transfer the blockchain files to the DB.

If you do that take a look at the views that are already defined in the DB, some of them may be useful to you.


Is 2016 a good time to buy an ASIC miner? At first, I should add I am not looking at mining for income. I just want to do it for fun but I don't want to waste money either.

In spite of difficulty increases there are a lot of people and companies which are starting to mine Bitcoin and I am one of them who want to start it for fun. So, I want to know whether it is a good time to buy an ASIC (Bitmain S7)?

The electricity cost is very low in my country, so what do you recommend?

Although the miner you're considering is a great entry level unit, 2016 will bring in the "halving" of the reward on bitcoins mined. This means, once a solution is found, the reward will be half the number of bitcoin. (http://www.bitcoinblockhalf.com/) You may want to join a pool, which you can help mine bitcoin and the reward is split up depending on the rules of the pool. It's a good way to be a part of the community and possibly earn bitcoin.


Bitcoin-Qt Command line - adding private key - Mac OSX I recently created a custom Public key (with vanitygen) and i would like to add the corresponding private key to my bitcoin-Qt wallet client.  I have started bitcoin-Qt in server mode using:

$ open Bitcoin-Qt.app --args -server

And then issued the following commands, yet i cannot seem to successful add the private key, can anyone tell me what i am doing wrong?

$ curl --user bitcoinrpc --data-binary '{"method": "walletlock" }' http://127.0.0.1:8332/
Enter host password for user 'bitcoinrpc':
{"result":null,"error":null,"id":null}

$ curl --user bitcoinrpc --data-binary '{"method": "walletpassphrase", "params": ["************", 120] }' http://127.0.0.1:8332/
Enter host password for user 'bitcoinrpc':
{"result":null,"error":null,"id":null}

$ curl --user bitcoinrpc --data-binary '{"method": "walletpassphrase", "params": ["************", 120] }' http://127.0.0.1:8332/
Enter host password for user 'bitcoinrpc':
{"result":null,"error":{"code":-17,"message":"Error: Wallet is already unlocked."},"id":null}

$ curl --user bitcoinrpc --data-binary '{"method": "importprivkey", "params": ["************", "************"] }' http://127.0.0.1:8332/
Enter host password for user 'bitcoinrpc':
{"result":null,"error":{"code":-4,"message":"Error adding key to wallet"},"id":null}

So what happens is, when i try to decrypt my wallet it just says 'null' as a response.  At first i thought it wasn't actually decrypting, but if i lock it and then try twice to decrypt it, it tells me "Error: Wallet is already unlocked".

Great! so it is unlocked and we should be able to now add the private key, but i just get error code -4 ? what is error -4 ? how do i make this work??

Error -4 means that you've already added that private key. It might take a while to import because it's rescanning the whole blockchain for transactions involving that address.


Lightweight Wallets Communication with Blockchain I understand how the Bitcoin core wallet communicates with the blockchain, but how do the lightweight wallets like Multibits, Electrum, etc, communicate with the blockchain?

You should have a look at the SPV (https://en.bitcoin.it/wiki/Thin_Client_Security#Simplified_Payment_Verification_.28SPV.29_Clients).

It was also mentioned by Satoshi in his paper at page 5 point 8:
https://bitcoin.org/bitcoin.pdf


bitcoins from the future It is likely that the Galaxy Note 2 will be launched in August.  As it has taken two weeks to mine my very first bitcoin, it seems unlikely that I will have mined enough to purchase a Note upon release (unless the time between launch and release is about 15 years).

My plan was to bank on the idea that time travel will be possible, and so I would leave a calendar entry for my future self to travel back in time and credit my bitcoin account with the necessary funds that I have mined in the future (my future self can simply snooze the calendar entry for another decade if time travel is not yet possible).

However, it occurs to me that the bitcoin protocol is immune to this type of temporal shenanigans, as any future mined bitcoins are not in the block chain and so cannot be used in contemporary transactions.  Even if the source bitcoins were already generated, no transactions would exist that showed them to be mine.

I am impressed that our future selves cannot tamper with bitcoins in the past, but I wanted to confirm that I haven't missed anything.  Is there a workaround that my future self could employ so that they didn't have to convert to gold or diamonds first (considering some time travel techniques only permit living tissue and their contents to be transferred).

Your future self could memorize some SatoshiDice secrets after they are revealed.  This would allow him to win every dice bet he placed after travelling back in time, since knowledge of a day's secret allows one to determine whether a bet will win or not before placing the bet.

There is a theory that this has already happened.


What are the most secure-yet-convenient ways of creating a wallet, that require just remembering a password? A friend just asked me "where are the 11 BTC I bought from you half a year ago? ... I don't remember where I put them." He formatted his computer a few months ago, and the money is probably lost (all of your BTCs just got 5.2E-7 more valuable).

I'd like to recommend an easy to use wallet with the following requirements:

You only have to remember a password/passphrase to access all your BTC. Bonus: transaction history as well.
It's super secure. I mean, I'd like 2-factor authentication, and keys should not be stored on the server (maybe only half a key). Let's assume the client computer is Trojan infected as well.
No ID/bloodwork/whatever is needed to use it (I don't know what Mt. Gox requires of "verified" users nowadays).
It is developed by a relatively trusted company/people. Trust is subjective, but still you can provide concrete evidence of why company X is "more trusted by the community" than company Y.
I'd prefer a no-install browser based wallet, but not if it conflicts with any of the above requirements.

Are there wallets that comply with most/all of these requirements?

Take a password.
Hash it with SHA.
Use the hash as a private address.
Generate your public address from that private address.

Guess this would be the easiest algorithm for having a deterministic wallet. One could easily make a web service or a program to generate those addresses, but people generally don't trust third party services like this.

EDIT:
StrongCoin allows one to generate a private key from any sentence, and given that they encrypt the private key before your browser sends it out, one can trust them not to know it. Then, you can decrypt the private key (as far as I know, also on your machine), and import it wherever one needs (provided you don't want to keep your coins online). It is a small workaround, but seems to fulfil your friends' needs.


Is it possible to view others' transactions in bitcoin client? This seems like a really basic question, but I'm having trouble searching for answers on it. My understanding is that my bitcoin client (Bitcoin v0.7.1-beta) has basically theoretically downloaded the entire transaction history of every bitcoin transaction that has ever occurred. I can see my own transactions in the Transactions screen. Is there a way to see transaction with wallets that I haven't imported or created on this client? I'm just trying to get a full understanding of bitcoin technology here. Is the reason the client doesn't show transactions from other wallets due to:

User friendliness - it would be overwhelming to have to search through all wallet addresses when most people only care about their own (is there a way to override that?);
Technical limitations - it's impractical to consider every transaction in the huge database when you want to list or look up some particular piece of information;
Design limitations - Not every transaction is actually there with all the information necessary;
Privacy concerns - By making it too easy to view others' transactions people would yell out about privacy more vocally;
Something I missed?

Is it possible to view others' transactions

Yes.

  in bitcoin client?

No.

It's not terribly useful to look up the balance of somebody else's address, except maybe so they can prove they have a certain amount of funds.
These lookups would be slow, because it needs to work through millions of transactions. Creating the indexes that would allow you to do fast lookups on any bitcoin address would take a sizable amount of disk space.
All of them are there - it's a central part of the bitcoin protocol. What if somebody moves all of their money out of their account within a transaction you don't know about? Therefore, you have to know about all transactions, unless you want to be surprised when their payment "bounces."
There's already a website called Bitcoin Block Explorer that pretty clearly establishes that transactions are public. Even if there wasn't, you could still build your own.


Mining behind a proxy and restrictive firewall (only http ports allowed) - possible? I have a very restrictive firewall with an additional proxy here. Is there a GPU mining tool out there that supports proxy server?
The best would be a SSL connection to the mining pool. A long living stream also doesn't work I think, because Internet radio is not possible.

I don't have a PC on the outside, so SSH tunnel is no option.

Edit:
Mining over a website could be a solution too. I tried http://www.bitcoinplus.com/ and it worked after setting the http proxy to a correct value for Java.

After searching and searching I found these possiblites.

Use bitminter Java client in Version 1.1.2 http://bitminter.com/client/1.1.2/bitminter.jnlp (current version doesn't work)
Make your own miner which supports proxy
Use a tool like Proxifier (I have not tested it personally, because it is commercial)


Filesystem is corrupt. How to find wallet.dat? A customer of mine brought me a 2TB crashed harddrive. The drive itself is not damaged physically, but the file tables (MFT / NTFS) are corrupt so there is zero ability to recover files with their original names.

The contents of the drive is not important, except for the customer's wallet.dat file which contains "a substantial amount of bitcoins" (sic).

Finding this file among 2TB of data is pretty much a needle in a haystack.

So, question: Does wallet.dat contain anything unique, anything that can be binary searched for, anything that makes it say "hey, I'm wallet.dat!"?

It has magic bytes plus a version number at byte 12 in the file:

00000000 [00 00 00 00 01 00 00 00] [00 00 00 00] [62 31 05 00]
                     ^ lsn               ^ page num    ^ magic
00000010 [09 00 00 00] [00 20 00 00] 00 [09] 00 00 00 00 00 00
               ^ version     ^ page size  ^ db type

Searching for 62 31 05 00 09 00 00 00 should get you what you're looking for.

Source: berkleydb source code: layout, magic number

If that doesn't work, there are a couple of patterns you might find handy:

00 01 07 6b 65 79 6d 65 74 61 (keymeta)
00 01 0a 64 65 66 61 75 6c 74 6b 65 79 (defaultkey)
00 01 0a 6d 69 6e 76 65 72 73 69 6f 6e (minversion)
00 01 09 62 65 73 74 62 6c 6f 63 6b (bestblock)
00 01 03 61 63 63 (acc) Account
00 01 03 6b 65 79 (key)
00 01 04 63 6b 65 79 (ckey) Encrypted key
00 01 04 6d 6b 65 79 (mkey) (Only in encrypted wallets)
00 01 04 6e 61 6d 65 (name)
00 01 07 70 75 72 70 6f 73 65 (purpose)

There's a list of the tokens it uses in this source file, and you can see an explanation of what they correspond to here.


How many people own crypto currencies? Is there an estimate on how many people in total own some cryptocurrencies?

How is this distributed among bitcoin and altcoins?

As Luca mentioned it is really difficult to measure, but there is a way to map Bitcoin addresses to IP address under certain conditions.
Refer this paper

Title : An Analysis of Anonymity in Bitcoin using P2P Network Traffic.

Authors : Philip Koshy, Diana Koshy, and Patrick McDaniel.

Note: It analyses relay pattern of transactions. It cannot analyse transactions that are already confirmed in blocks.

Some companies publicly disclose their data and it might be possible to come up with a ballpark estimate.  Blockchain.info shares the number of wallets used in their My Wallet service.


How can I temporarily move my value to something other than bitcoin without providing identifiaction? Bitcoin is in a bubble right now, I would like to sell them as I believe the value will drop within a couple of days. I tried registering an account on mtgox, but it's complicated and they seem to have some problem to keep up with registrations(my account isn't confirmed yet)

I want to sell my bitcoins so I can trade them back. I looked at litecoin, wich seems like a nice option, but their value has also gone up a lot the last couple of days, relative to bitcoins. Are there any other options available?

http://campbx.com is another exchange; I believe no customer verification is required until you want to move USD in or out.  If you just want to sell bitcoins and plan to buy them back later, I don't think ID would be needed.


Signing Bitcoin transactions There is a part of the Bitcoin protocol that I don't quite understand.

When you make a transaction, and spend the output of a previous transaction for say 1 BTC, you provide a signature using the private key matching the public key (or address) that appears in the output of the previous transaction. My first question here is what exactly is signed?

Second, when the transaction is broadcast, what prevents a malicious peer to take the input of my transaction with signature, for 1 BTC, and forge a new transaction using that same input going to their own address? To avoid that, the full transaction (including outputs) would need to be signed, I couldn't find a document indicating the whole transaction is signed.

From what I gather you sign both the input and the output of the transaction, meaning that nobody can alter the content of the transaction without invalidating your signature. I also had some problems with this part of the algorithm, and even asked a similar question earlier, but this one deals with more of the low-level bit operations rather than the high-level concept.


Simple cryptsy market price observer HOW? I am trying to use the cryptsy's API to get the current price of doge. This is my code.

public class Main {

   static Market [] markets;

   public static void main (String [] args) throws CryptsyException, InterruptedException{

      Cryptsy cryptsy = new Cryptsy();
      cryptsy.setAuthKeys("<authkey>", "<authpass>");

      markets = cryptsy.getMarkets();
      while(true){
         for(Market market : markets) {
            DecimalFormat df = new DecimalFormat("#.########");
            if(market.label.equals("DOGE/BTC"))
               System.out.println(market.label + "   " + df.format(market.last_trade) + "   " + market.current_volume );
         }
      TimeUnit.SECONDS.sleep(5);
      }
   }
}

the problem is that the price get updated too rear (30 mins or something) and only if I restart my program. Anyone to know hot to get the current price?

Your problem is that you only get the market data once, then keep displaying the same values.  Move your call to cryptsy.getMarkets() inside your while loop, like so:

public static void main (String [] args) throws CryptsyException, InterruptedException{

      Cryptsy cryptsy = new Cryptsy();
      cryptsy.setAuthKeys("<authkey>", "<authpass>");

      while(true){
         markets = cryptsy.getMarkets();
         for(Market market : markets) {
            DecimalFormat df = new DecimalFormat("#.########");
            if(market.label.equals("DOGE/BTC"))
               System.out.println(market.label + "   " + df.format(market.last_trade) + "   " + market.current_volume );
         }
         TimeUnit.SECONDS.sleep(5);
      }
   }


Open source, how can I view "Transaction Create a new transaction" and "Sign Transaction"? Not long ago I saw on the site github.com the very first Nakamoto code:

https://github.com/livegnik/BitCoin-v0.01-ALPHA

Running bitcoin.exe, I did not find the console. If the program is open source, how can I view "Transaction Create a new transaction" and "Sign Transaction"?

I know that the program is written in C++
I would love to see the "Transaction" processes as on https://coinb.in
Coinbin source code is written in javascript. Can I view in C++?

The original Bitcoin client did not have a debug console or many things that we see in modern Bitcoin software. Furthermore, it is a compiled software (C++ needs to be compiled) so you can't inspect the thing being run for its source code. However, Satoshi did publish the source code along with the pre-compiled binary. For transaction creation, you can find this in the repo you linked in src/main.cpp. It is the function named CreateTransaction. Another copy of the original distribution can be found on nakamotoinstitute.org.

Lastly, Bitcoin Core is based on the original client's codebase. It's commit history goes all the way back to 0.1.5 so you can see code that is very similar to the original release and view the code for any version between 0.1.5 and modern Bitcoin Core.


Should you be able to insure Bitcoin the way banks insure bank accounts? If insurance for Bitcoin were available for Bitcoin losses what kind of losses would the insurance cover?

It is covered by a cyber-insurance policy, the kind taken out by businesses that need to provide proof of security audits, etc. in order to get the insurance. NAIC lists things that would be covered (http://www.naic.org/cipr_topics/topic_cyber_risk.htm), which includes;
"Theft of valuable digital assets, including customer lists, business trade secrets and other similar electronic business assets." These policies are not typically offered to individuals.

The problem, and the reason why this is true, is that these policies are very expensive, relative to cost, and there is a adverse selection problem in insurance (https://en.wikipedia.org/wiki/Adverse_selection), as well as moral hazard (https://en.wikipedia.org/wiki/Moral_hazard) - so insurers won't ever fully cover these small risks that they can't observe or protect against, because they will end up losing money on them.


Why bitcoind does not respect rpcbind for testnet? For some reason testnet does not respect bitcoin.conf RPC configuration:

admin@az-bitcoind:~$ sudo netstat -natp | grep 8332
tcp        0      0 10.18.0.1:8332          0.0.0.0:*               LISTEN      582/bitcoind
tcp        0      0 127.0.0.1:8332          0.0.0.0:*               LISTEN      582/bitcoind
tcp        0      0 127.0.0.1:18332         0.0.0.0:*               LISTEN      581/bitcoind
tcp6       0      0 ::1:18332               :::*                    LISTEN      581/bitcoind

Expected: bitcoind bound to 10.18.0.1:8332 and 10.18.0.1:18332 and 127.0.0.1:8332 and 127.0.0.1:18332

Reality: bitcoind bound to 10.18.0.1:8332 and 127.0.0.1:8332 and 127.0.0.1:18332 and ::1:18332. NOT 10.18.0.1:18332

Here is my bitcoin.conf

# Accept command line and JSON-RPC commands
server=1

# Set database cache size in megabytes (4 to 16384, default: 450)
dbcache=1536

# Set the number of script verification threads (-6 to 16, 0 = auto, <0 = leave that many cores free, default: 0)
par=1

# Set to blocksonly mode, sends and receives no lose transactions, instead handles only complete blocks
blocksonly=0
maxmempool=256

# Tries to keep outbound traffic under the given target (in MiB per 24h), 0 = no limit (default: 0)
maxuploadtarget=256

# Maintain at most <n> connections to peers (default: 125)
maxconnections=32

# Username for JSON-RPC connections
rpcuser=bitcoinrpc

# Password for JSON-RPC connections
rpcpassword=b956a61a2b6b8d30a744165384e3b61e

# Allow JSON-RPC connections from, by default only localhost are allowed
rpcbind=127.0.0.1
rpcbind=10.18.0.1
rpcallowip=127.0.0.1
rpcallowip=10.18.0.0/24

# Maintain a full transaction index, used by the getrawtransaction rpc call (default: 0)
txindex=1

# Make the wallet broadcast transactions (default: 1)
walletbroadcast=1

Am I doing something wrong?

I still have no idea as to WHY this is happening. But changing config to this:

[main]
# Allow JSON-RPC connections from, by default only localhost are allowed
rpcbind=127.0.0.1
rpcbind=10.18.0.1
rpcallowip=127.0.0.1
rpcallowip=10.18.0.0/24

[test]
# Use the test chain
testnet=1

rpcbind=127.0.0.1
rpcbind=10.18.0.1
rpcallowip=127.0.0.1
rpcallowip=10.18.0.0/24

Solved the issue

admin@az-bitcoind:~$ sudo netstat -natp | grep 8332
tcp        0      0 10.18.0.1:8332          0.0.0.0:*               LISTEN      566/bitcoind
tcp        0      0 127.0.0.1:8332          0.0.0.0:*               LISTEN      566/bitcoind
tcp        0      0 10.18.0.1:18332         0.0.0.0:*               LISTEN      567/bitcoind
tcp        0      0 127.0.0.1:18332         0.0.0.0:*               LISTEN      567/bitcoind

No idea why I have to duplicate this settings. I assumed that as long as [main] or [test] are not specified, all config options apply in general


How does initial exchange of inventory work when both nodes have different chains? When two nodes connect to each other and exchange getblocks messages but they have different blockchains will both nodes download each others blockchain to verify which has higher chainwork or will they somehow exchange chainwork beforehand or something completely different?

They will exchange chainwork. The one that claims a lower chainwork will query the other to confirm that its claim for a higher chainwork is legitimate. If it can confirm the claim, then it will switch to the chain with the higher total work.


Pay button with 2 receiving addresses I am new to bitcoin technology, I want to build Bitcoin payment button with 2 bitcoin addresses, first is my site address where I will receive a small commission fee, second is my site seller address. When a customer pay, bitcoins will be send to both addresses, is that possible?
Thanks

It's possible, but difficult to do with standard wallets. What you can do is have a third address that your clients will see, and when you receive bitcoins there, then split them to the other two addresses that you want.


How can i accept Bitcoin donations or payments on my website? I have seen all these other posts on how to do it, but they are all so complicated, what is the quickest, easiesy way to accept Bitcoin payments or donations on my website? Why is it all so difficult?

BitPay is an electronic payment processing system for the bitcoin currency. It enables online merchants to accept bitcoins, as a form of payment, just as they accept payments from Visa, Mastercard, or Paypal.

BitPay is available in every country, and you can set your prices in over 30 different currencies.

Merchants choosing to keep the bitcoins can be anywhere in the world. Merchants in some countries can choose to receive a direct deposit into their bank account.


Explain the math behind mining profitability calculators Can anyone explain the math behind the mining calculators like:

http://www.bitcoinx.com/profit/

I'm trying to build a Google spreadsheet that does the same thing.

Suppose your hashrate is H hashes per second.

There are 86400 seconds in a day, so every day you will generate 86400H hashes.

Every hash has roughly 1 in 2^32 chance to be a share, so you'll find 86400 H / 2^32 shares.

Every share has a chance of 1/D to be a block, so you'll find on average 86400 H / (2^32 D) blocks per day (currently D = 267731249).

Every block gives a reward of B, so you'll get on average (86400 H B) / (2^32 D) per day. (Currently B = 25 bitcoins).

Then you can take into account additional factors such as the exchange rate, power costs, difficulty going up over time (requires computing an integral), and so on.


Is buying bitcoin with paypal legal without laundering concerns? I'm a software developer, and I want to make a website that allows users to sell bitcoin instantly for paypal cash without the hassle of an exchange - I don't even want to make a profit from it. The idea of it is to be a 100% fair exchange, instant, and no account/signup needed to encourage more people to use bitcoin.

Regardless, I was thinking last night and wondered if money laundering here is a concern? For example, a user stole bitcoins and sold it with my exchange. Is it the sellers responsibility to ensure funds are clean (since we are dealing with fiat cash)? What if someone buys bitcoin with dirty money and tries to sell the bitcoin on my exchange for clean the money? Would the seller be in trouble even though there is know way to know funds are legit? I am in the US.

While I’m not an attorney, the website you describe would be considered a “money transmitter business” (MTB) which, in the US, falls under the jurisdiction of The Dept. Of Treasury FinCEN (Finacial Crimes Enforcement Network) which has regulations to prevent money laundering with strict anti-money laundering (AML) policies. You would need to register with FinCEN and comply with their regulations to legally perform such transactions on your website regarding AML/KYC (KYC is Know Your Customer). MTB laws also vary from state to state when it comes to cryptocurrency exchange for fiat money or vice versa. Just make sure to consult with a lawyer before you go live to protect yourself.


Litecoin binary for Linux Is there any LiteCoin binary precompiled for Linux?

I would prefer staticaly linked but would also dynamicaly linked a try.

A plus is given for a .deb archive, two pluses for a ppa or other possibility to integrate it into ubuntu 11.10 packagemanagement.

(I'm trying to close some old questions.)

Litecoin has a Linux download button on it's homepage now.

As Nick Odell pointed out, you can also find the downloads on GitHub.


How to get the Public Keys of a bitcoin User Is there some way in which I could get the public key of a Bitcoin user ?

Lets say I have transaction with another Bitcoin user. Is there some means by which I can retrieve the public key of the Bitcoin address they used in our transaction?

How does https://slock.it/ guys does it ? From where do they get the public key from ?

https://www.youtube.com/watch?v=-Ht23KXic1k

You cannot compute the public key of an address (that is not yours), because the address is computed from the hash of the public key.

You can find the public key of your own address with the Bitcoin-QT debug window or with a validateaddress RPC call.


I sent btc from my wallet to my web site balance, deposit never showed I have had hundreds of confirmations but the funding never made it from my wallet to the balance I was maintaining on a Web site (Alhabay). On blockchain the transaction is listed as "unspent." Where did my funds go? Can I get them back? I've been trying with zero success to get help from Alphabay.

Thank you.

You will need to contact the site, Alhabay, for support. This is your only way. The bitcoins have been sent and confirmed on the blockchain, and they are in Alhabay's possession right now.

Bitcoin is like cash. It's irreversible. Once you've gave someone cash, they have it and the only way you can get it back is if they give it back to you.


Is that proved that for each block there is always nonce value which will make block hash to start by n count of 0 Sorry for the obvious question, but I'm looking for a mathematical prove.

Block header is calculated as a concatenation of the following values.

Version
hashPrevBlock
hashMerkleRoot
timeStamp
Bits
Nonce (32-bit number)

First 5 parameters are static for each block. Miner only tries to find out Nonce value, such that Hash(Block_header) will start with a certain number of zeroes.

Is that proved that for each combination of Version, hashPrevBlock, hashMerkleRoot, timeStamp and Bits there is a Nonce value, that will make block hash to start with a certain number of zeroes?

If yes, can you please share any article that explains that prove?

Cryptographic hash functions are collision resistant and the digests produced by SHA-256 are approximately uniformly distributed. This suggests that if the input space to the hash function is magnitudes bigger than the projection space of a hash function, we would expect that every value of the projection space can be hit.
The block header is 80 bytes, and the digest space of SHA-256 is 32 byte (256 bit). Out of the 80 bytes of the block header, version is unrestricted on 29 of 32 bits, the nonce is a 4-byte arbitrary value, the Merkle root is a 256-bit digest derived from an enormous combination space, the timestamp is rather flexible—limited to a unix timestamp range of roughly 3h/10,800 seconds (~13 bits), only the previous block hash and difficulty statement are fixed. So, before counting the Merkle root, miners could generate up to 74 bits of entropy in the block header.
The Merkle root is derived from the set of transactions that a miner is choosing to include in their Bitcoin block. Not only can the miner arbitrarily pick content and order of the (valid) transactions, but also each miner is paying themselves in the coinbase transaction of their block candidate. Given that paying to different addresses results in different coinbase transactions, every miner is working on a unique transaction set whose Merkle roots making any overlap between block candidates of different miners astronomically unlikely. Further, parts of the coinbase transaction's input can be picked arbitrarily (the "extranonce" and most of the remaining 2–100 byte input script of the coinbase transaction) giving miners a way to easily add further entropy to the set of block candidates they're evaluating. Additionally, miners update their block candidate's transaction composition whenever more new transactions paying higher fee rates arrive. Even if there were no transactions to add in the block, miners could just generate a different address to pay themselves for use in the Coinbase after exhausting the nonce and extranonce space.
Given the power set of all possible transaction orders, the address space of Bitcoin, and the 100 byte input script in sum by far exceed the 32-byte digest size of SHA-256d, I'd argue that the Merkle root provides a full 32 bytes of entropy.
In sum that gives the miners ~41 bytes of arbitrary input data to produce a 32-byte digest i.e. an input space 272 bigger than the projection space. Meanwhile, a block is only restricted to the current difficulty which is significantly smaller than 2224 (the difficulty of requiring a block hash 000…0).
While this doesn't meet the requirements of a rigorous mathematical proof, I'd surmise that miners do not have to worry about running out of possible block candidates. Therefore, it's just a matter of time until someone happens to succeed at creating a new valid block.
Also see this closely related question here: How can we be sure that a new block will be found?.


OS X 10.7 - Where is Bitcoin data stored? Possible Duplicate:
  Is there wallet.dat for OSX?

Upgrading my HD; clean install and I want to copy the wallett etc from old hard drive. What do I need to copy? Thanks in advance.

Bitcoin data on Mac OS X located in ~/Library/Application Support/Bitcoin/ . Just copy the whole folder to the new HDD to use your old wallet and downloaded blockchain with the new copy of Bitcoin client.


What are the effects of leaving Bitcoin-QT open? I'm using bitcoin-qt at the moment, and at the bottom of the download page it says:

"Do you have a computer that you keep switched on all the time, that's connected to the Internet? You can help the community by simply running the original Bitcoin client on it. The original client is more resource intensive and will take a complete day to synchronize. After that your computer will contribute to the network by checking and relaying transactions."

Clicking the "original bitcoin client" just takes me to the same download as clicking "bitcoin-qt" (http://bitcoin.org/en/download). Does this mean leaving it open is mining, or doing something else? (or does it even use my resources?)

Bitcoin-Qt is the original Bitcoin client.

Leaving it open has no real consequences considering yourself individually, but there are some minor effects.

Effects regarding you:

When you leave your client open, your client will always be in sync with the network, meaning that you can always see your accurate balance. If you should close it, it will have to catch up syncing before it can show you your addresses' balances.
As explained in this answer, when you send a transaction into the network, there is a small chance that it may get lost. In that case, when your client is still open, it will re-transmit the transaction automatically. When your client is closed, the transaction will be lost and never confirmed. Note that the chance that a transaction gets lost is very small.

Effects regarding the Bitcoin network as a whole:

Bitcoin is a peer-to-peer system, in which all Bitcoin clients function as nodes. But not every node knows of the existence of all other nodes. A transaction is made by sending it to all nodes in the network. When your client is open and connected to the network, it has a list of other nodes it knows about. When one of them sends a transaction to all the nodes it knows, you help him by sending it forth to all the node you know about. This way you can help reduce the time it takes for a transaction to reach the whole network.
Together with relaying transactions, your client will also check all transactions it receives. It is possible that some of them is malicious, meaning that the sender does not have the right to spend the bitcoins he is spending, or that these bitcoins are already spent. In that case, your client will ignore the transaction and not relay it.
Another thing your client does is helping new nodes synchronize. When a new client enters the network, it has to build the block chain from scratch. It will request other nodes to send parts of it to him so that he can save them. When your client is open, it will help other users download the block chain.

Note that it is not an effect of leaving your client open that your bitcoins are less protected. Encrypted wallets are only decrypted for spending bitcoins.

Also, your client will not mine while it is open, so the process it not very resource-consuming.


Who is the certification authority in Bitcoin? If you would compare Bitcoin with electronic banking there are quite a lot of similarities like the encryption and hashing with private and public keys.

In electronic banking though the bank is the certification authority.  Who is doing this in blockchain/Bitcoin?

Depending on what function of the certification authority you are looking for, Bitcoin doesn't need one, or the blockchain does it.

Identity in e-banking vs identity in Bitcoin network

Electronic banking relies on the communication between bank and customer being secure which is what they use encrypted protocols for. They don't use either hashing, nor private and public keys in any similar fashion as Bitcoin. Actually, when you order a payment through e-banking, you have to reveal all the secrets to the bank to authenticate yourself: E.g. you put in your user name, your password, and then a specific one-time code as requested by the bank, or when using a credit-card, you give name, credit card number and security code. As these pieces of information would be sufficient to hijack the payment in a man in the middle attack, communication needs to be secure and encrypted. To that end, a certification authority gives out "passports" that allow you to make sure you're talking to the right entity.

On the other hand, communication in Bitcoin is authenticated by the content of the message itself. When you order a payment, it includes a signature that could only have been created by the owner of the address that held the money previously. Nobody can change the message, because the signature would be invalid for any other message, and they cannot produce another valid signature without having access to the private key. The secret is not revealed to order the payment. Therefore, it is not necessary to encrypt communication within the network, and also there is no need to certify the identity of network participants. One can tell directly from the message whether it is valid or not, making the identity of the source of the message irrelevant.

Authenticity of payments in e-banking vs Bitcoin network

In e-banking only the bank and you know your balance. Therefore, when you order a payment, the bank will check their ledger and confirm the payment.

In Bitcoin, everyone can check whether a balance is available to be spent. As explained above the transaction order itself can be checked for validity by every participant, so it is impossible to spend money that isn't yours. The blockchain keeps track of the balances, therefore becoming the ledger everyone referring to when checking payments. Yet, the blockchain is extended in a decentral process, so while the blockchain is central to the network, it is maintained decentrally.

Where e-banking and Bitcoin are similar

The one thing that still can be attacked in the same way in Bitcoin as in e-banking is the other side of the payment: People can try to fool you into paying something that you didn't intend to pay for. You still need to figure out where to send money. That's where Banking and Bitcoin have the same vulnerability to phishing sites. In fact, Bitcoin is a bit at a loss there, because once you've sent the money it's gone, while you may have a recourse through your bank by having them reverse the payment.


Have bitcoin developers applied the solution for selfish miner attack? The Majority is not enough paper proposed an academic and somehow practical attack to Bitcoin mining system based on creating hidden forks. The paper claims that if miners work on whichever fork they received first, the attack can be executed by very small pool. Their proposed solution is: "when a miner learns
of competing branches of the same length, it should choose which one to mine on uniformly at random". However this solution does not solve the problem completely, it just increases required size of the pool which want to execute the attack.

I have read about the attack here and here, however, I didn't find answers of my questions:

Is the attack really practical?
Have bitcoin developers applied the solution proposed in the paper? (If yes, why the wiki is not updated? The wiki states: "generating nodes build onto whichever one of the blocks they received first")
Have bitcoin developers applied another solution for the problem? (The solution proposed in the paper does not solve the problem completely)

EDIT:

why mining on both chain forks uniformly would increase the required mining power for a selfish mining attack?

Mining on both chain forks uniformly is a solution to sybil attack of the selfish miners. Selfish want to force other miners to work on their fork, so they create a significant number of zero-power miners to the Bitcoin miner network, as their sensor. When one of their sensors senses a new valid block, all sensors broadcast the fork of the selfish miners. Therefore, more than half of miners (nearly all of them) would work on selfish miners fork.

Note that, the sybil attack and their proposed solution is minor part of the attack. The main attack could be executed without running sybil attack and even in the case of applying their proposed solution, if the selfish miners have 33% of mining power.

Note that there is a new and better paper about this topic by Aviv Zohar et al. - http://arxiv.org/pdf/1507.06183v1.pdf.

None of the solutions suggested have been implemented yet. The attack is significant enough that some solution will need to be found, but that's up to researchers, not developers.


bitcoind json-rpc requests per second I'm starting up a new bitcoin based commerce site and am wondering how many transactions per second the bitcoin JSON-RPC API can accept? A user can have an account balance in bitcoin and I was initially thinking of storing all transactions in a database and then querying that to determine their account balance, but after reading up on blockchain reorgs and whatnot decided against it.

So is it feasible to just use the bitcoin API directly, or should I implement some sort of caching/load balancing?

Benchmark it and see, although be aware that bitcoind has never been optimized for handling thousands of accounts with hundreds of thousands of transactions. In particular, calls like 'getbalance' get slower the more transactions that are in the wallet.

Happily, there are now other implementations that claim to be better at handling lots of accounts/wallets/transactions.


Why downloaded Block Size doesn't match with actual block size mentioned on network? I am trying to download a block(Height:474044) using an API from here in python. Block is obviously downloaded in JSON format. But when I store it in a file on my system it shows very weird size number, not matching with actual blocksize on network. I also tried to download data in hex format using this link. But still, when I try to store it in a file(JSON/Text), It is not showing the size same as shown in block details officially. I have intentionally chosen a block before segwit BIP to avoid any further confusion. Help me to confirm my downloaded blocksize with actually mentioned on network. This question might seem naive to some users as I am new to bitcoin. Thanks for help in advance.

For one, there is no JSON block format - different APIs have different ways of interpreting and displaying a block in a JSON response, and none of them will ever match the block size.

Your mistake appears to be saving the actual hex block as text.

1996396 = 2 * 998198

You must write the data as an actual binary file. i.e., write 12 as the byte 0x12, instead of saving the text "12" directly, which will write the bytes 0x3132 to disk, doubling the size of the file saved. Saving it as text will double the file size, as you've noticed already.


Modular Inverse for ECDSA in C++ I've seen several variations on "modular inverse" but I can't seem to identify the proper way of utilizing it for C++.  I'm not sure how this python code translates into c++:

def inverse(x, p):

"""
Calculate the modular inverse of x ( mod p )
the modular inverse is a number such that:
(inverse(x, p) * x) % p == 1
you could think of this as: 1/x
"""
inv1 = 1
inv2 = 0
while p != 1 and p!=0:
inv1, inv2 = inv2, inv1 - inv2 * (x / p)
x, p = p, x % p

return inv2

My current coding is here:
http://coliru.stacked-crooked.com/a/74648b16c2692525

But it only shows like the first public key properly, after that it messes up.

#include <openssl/bn.h>

[...]

BN_mod_inverse ( a, b, c, ctx );


What is Bitcoin locking and unlocking script? The locking script on an UTXO and the unlocking script are written in bitcoin scripting language. When a transaction is validated, the unlocking script in each input is executed alongside the corresponding locking script to see if it satisfies the spending condition.
Can someone explain the nitty gritty of Bitcoin script with locking and unlocking script?

There are quite a lot of things going on there, so let's break it down bit by bit.

Transaction structure

A transaction can be seen as a collection of inputs and outputs. Inputs refer to previously created UTXOs, while outputs generate new ones. Therefore, when creating a transaction each input spends a UTXO and each outputs creates one.

Outputs structure

Outputs is what contains the so called locking script, or how it is normally referred in a transaction, the scriptPubKey. Such an script contains the condition required to spend such a UTXO.

Inputs structure

Inputs contain references to previously created UTXOs (through the prev_tx_id and prev_out_index fields). Moreover, inputs contain the so called unlocking scripts, or how they are normally referred, scriptSig. Such scripts require the proof of fulfilment of the conditions specified in the UTXO each input is trying to redeem.

Examples

The most commonly used transactions in Bitcoin, and therefore the most common example of this, are Pay-to-PubKey-Hash (P2PKH) transactions, or transactions that pay to a Bitcoin address. A script "paying to a Bitcoin address" will require that you can proof to be the "owner" of such an address. Let's see how this works:

P2PKH transaction

A transaction creating a P2PKH UTXO will have a scriptPubKey looking as follows:

ScriptPubKey = OP_DUP OP_HASH160 <hash160(pubKey)> OP_EQUAL OP_CHECKSIG

Whereas a transaction tying to redeem such an UTXO as an input, will have a scriptSig looking as follows:

ScriptSig = <sig> <pubKey>

If we put both scripts together in a stack, like Bitcoin does, what we get is the following script:

<sig> <pubKey> OP_DUP OP_HASH160 <hash160(pubKey)> OP_EQUAL OP_CHECKSIG

In order to analyze the script you should have two things in mind. There are two types of clauses, opcodes and data (represented between < >). Moreover, scripts are read left to right, and data is used as input to opcodes.

The execution of the script will first duplicate the public key (since is the first operation of the script), and compute the hash160 of it. Then it will check if the computed hash160 matches with the one provided in the UTXO the input is trying to redeem, and finally it will use the remaining public key (recall that we have duplicated it) and the signature to check the correctness of the signature.

You can find more info about the validation of P2PKH in the Bitcoin dev guide. Moreover, there are several other examples of this. You can find the standard types of transactions also in the dev guide. An extensive list of Bitcoin Script opcodes can be found in the Bitcoin wiki.


Does assumevalid lower the security of Bitcoin? Bitcoin's assumption was to download the blocks and verify it in order to prevent getting fooled.

But by default, the assumevalid option is enabled in the software, which, as I understand it, makes some data (until 2017?) real without verification.

So, can we consider Bitcoin nodes safe? If so, why?

Of course, you can disable this option, but 99% of people may not even know that this option is enabled.

which, as I understand it, makes some data (until 2017?) real without verification.

You understand incorrectly. Firstly, the assumevalid blocks is updated at every major release, so it is at most a couple of months out of date for the most recent release. For Bitcoin Core 0.18.0, the assumevalid block is 0x0000000000000000000f1c54590ee18d15ec70e68c8cd4cfbadb1b4f11697eee which is from February of this year.

Secondly, assumevalid does not just make Bitcoin Core blindly accept blocks without validation. Bitcoin Core will still validate most parts of the block, including Proof of Work, UTXOs, amounts, etc. The only thing that is not validated are scripts because scripts are expensive. assumevalid just means that all scripts in transactions included in blocks that are ancestors of the assumevalid block are assumed to be valid.

Since it only assumes this for the ancestors of the assumevalid block, if there were a large work re-org which removed that block from the blockchain, all scripts would be validated.

  So, can we consider Bitcoin nodes safe? If so, why?

Yes, we can. Nodes are still validating other important things like PoW, UTXOs, amounts, etc. The block that is chosen for the assumevalid block is always one that is several thousand blocks deep at the time the PR is created to update the assumevalid block, and tens of thousands of blocks deep by the time the release is made. So it is extremely unlikely to be reorged out due to the extremely large amount of work required to do so. Even if it were reorged, Bitcoin Core wouldn't become insecure, it would just be a bit slower.

Furthermore, in order for that block to be updated in the codebase, multiple people need to agree with the change and sign off on it. Many developers do so and go further to PGP sign a message stating that they agree that this block is part of the main Bitcoin chain.

While this does introduce a little bit of trust, people can independently check that that block is part of the main chain be going to block explorers and looking up the block in their own node. They can check that this block and its ancestors are indeed valid.


Is there an Android app that will scan a QR code and show the balance? What I'm looking for is an app that lets a person scan a QR code containing a Bitcoin address and then see the balance and transaction history for that address.

For a specific use case, a mobile phone (or Android tablet, more likely) is going to be made available at an event to allow people to check the balance of their bitcoin address.  Attendees with their own smartphone can use their own mobile wallet app but for those without smartphones and those who don't know (nor care) about bitcoin, the QR code on their badge (or wristband) will work as their wallet for receiving small payments (rewards for their participation).  The badge might be something like  this, for example:

http://www.paymyaddress.com/

The app can be pretty simple -- a text field to enter the firstbits (and a button to optionally allow a scan of a QR code), and then the balance is displayed (with transaction history below, optionally).

Since it would be used by people just walking up, it shouldn't require any registration or login.  Simply scan and view.

BTCBalance.net would work for this but it isn't suited well for use from a mobile.

Has anything that does this been built already?

To get the balance and list of transactions you could do an HTTP get to blockchain.info. E.g:

http://blockchain.info/address/17w9uVZuPgsY7iLBVGB7qTZ1ZiZnTJKHLq


How can I restore my wallet? I just purchased a new laptop and I want to decommission my old one.  I have a back-up of my wallet.dat file copied to my new PC.  What do I need to do to restore it to my Bitcoin (Windows) client?  Please note, this is a wallet.dat file that is about 6 months old and I haven't loaded it in at least four months.  I'm not sure if that makes a difference or not, contingent on the original version of the client that created the file.

You need to put the old wallet.dat in your bitcoin data directory.

The default for Windows is:

C:\Documents and Settings\YourUserName\Application data\Bitcoin (XP)

C:\Users\YourUserName\Appdata\Roaming\Bitcoin (Vista and 7)

Then run the bitcoin client with the -rescan option.

Alternatively you can run the bitcoin client with the -datadir=<location of backup wallet.dat> as well as the -rescan option if you do not want to move/backup the new wallet.dat.

The default for Mac OS X is:

~/Library/Application\Support\Bitcoin

The default for Linux is:

~/.bitcoin


Creating a Bitcoin online wallet service My question is this:  Lets say I wanted to create a bitcoin site, where users register and can deposit bitcoins into their account. should i  use my MPK to generate infinite addresses, so after a user deposits into the address, a new address is automatically generated for that user. and if the user deposits to the old address can It be traced?

Also how would the user be able to withdraw their balance in only their account? I don't want my priv key exposed.  And how can the site fees be deducted from each transaction with out the user beign able to withdraw that as well, And how would i implement a escrow service for the site so the seller offers service and the buyer buys but the coins are stored until the buyer says release or my staff see that it should be released to the right person.

also how can I set up a multi-sig on the site  for those users that choose to use it?

a site similar to what am referring to is www.localbitcoins.com

And am not the talented programmer making the site, so I am safe giving him my MPK? Or what is "safe" for me to give him?

should i use my MPK to generate infinite addresses, so after a user deposits into the address, a new address is automatically generated for that user.

Yes, that's an intended use of BIP32.

  and if the user deposits to the old address can It be traced?

Assuming you remember the derivation of the key, sure. But it would probably be simpler to just keep a list of every Bitcoin address you've ever shown to a user, and compare incoming transactions against that.

  Also how would the user be able to withdraw their balance in only their account?

There are two ways to implement this:

Keep coins from different customers with each other in one big wallet. Keep track of how much each customer has in a separate database.
Make each address belong to a customer, and make sure that customers can only sign transactions using their own keys.

#1 has some advantages, but #2 is generally easier to implement without shooting yourself in the foot.

  I don't want my priv key exposed. And how can the site fees be deducted from each transaction with out the user beign able to withdraw that as well, And how would i implement a escrow service for the site so the seller offers service and the buyer buys but the coins are stored until the buyer says release or my staff see that it should be released to the right person.

I suggest that you not give your private keys to your users, especially if you're using BIP32 or you've chosen approach #1 above. Instead, generate and sign the transactions yourself.

As for escrow or manually releasing funds, you control the private keys, so you can move the coins at will. (That's something that your customers might not appreciate, since it opens the possibility that you'll steal all of their money.)

  also how can I set up a multi-sig on the site for those users that choose to use it?

I assume you mean 2-of-3 multisig between you, the buyer, and the seller. I've not used it personally, but I've heard good things about BitPay's copay implementation.

  And am not the talented programmer making the site, so I am safe giving him my MPK? Or what is "safe" for me to give him?

The site as you've described it requires you to have the extended private key on your server, or somewhere that your server can access. And, no, that's not safe to give to someone that you don't trust.


Verifying a bitcoin Signature and what is the transaction data that is signed? Given a bitcoin transaction where it is able to redeem it's UTXO's, how can I verify in Java if the signature is actually a valid signature or not. I was trying to use the Bouncy Castle library where I was trying to recreate the message that the private key signs over.

From what I know I need the following things -

1.The version number(4 bytes)
2.The number of Inputs(1 byte)
3.Transaction hash of the input being redeemed
4.Index of the output being redeemed (4 bytes)
5.ScriptPubKey of the output being redeemed prepended with the length of the script
6.Sequence Number(4 bytes)
7.No of outputs we are signing over(1 byte)
8.Total value of the output(8 bytes)
9.ScriptSig for the output prepended with the length
10.locktime field(4 bytes)
11.hashcode type(4 bytes)

I have tried to capture this information from the transaction data but when I try to verify the signature, it fails. Am I missing something?I want to be able to verify if a signature is correct. Thanks.

From what I have read, Step number 5 is a temporary step and the ScriptPubkey is replaced by some other value but I am unable to understand what that value should be.

What you described only works for transactions with one input and one output.

In general, what you do is you take the transaction that you want to verify, remove the scriptSigs from all of the inputs, and for the particular input you want, you place in the scriptSig the scriptPubKey (prepended by its length) of the output that input spends. If the output that was spent is P2SH, then you put the redeemScript instead of the scriptPubKey. Then you put the sighash type at the end of the modified transaction.

Once you have that message, you need to hash it with SHA256. Most cryptographic libraries take a message and hash it once. However in Bitcoin, the message is actually hashed twice. So to verify a signature in Bitcoin with a general purpose cryptography library, you need to hash the message first, and then allow the library to hash it again when it verifies.

Lastly, the message is different for inputs that spend Segwit outputs. This message is defined in BIP 143.


How can we be sure that a new block will be found? How do we know the HASH function will produce an output that fulfills the difficulty, i.e. is below 0000...xxxx...xxx?

Is it possible that no proof will be found so that the HASH will produce that output 000...xxx...?

The important thing here is, that every mining pool/solo miner is working on a different input: They have different coinbase transactions and are working on different sets of transactions. Further entropy can be added by changing the nonce and extra-nonce, by adding another transaction, or by changing the order of the transactions.

While there can be block inputs that won't succeed with any nonce, the complete network traverses over so many different inputs, that at some point a valid block will be discovered.

Finding a block is a Poisson process

Due to the hashing process being implemented as a Poisson process, if the network's hashing power matches the difficulty, the expected time to find the next block is exactly 10 minutes at every point of time.

The probability of a number of X blocks to be found in a time frame in which you would expect to find λ blocks can be calculated with the following formula:

So, in order to calculate the likelihood of an interval between blocks to be longer than the mean (10 minutes in an ideal world) by a factor λ we get p(0|λ) = exp(-λ)*(λ^0)/(0!) = exp(-λ)*1/1 = exp(-λ), e.g. the likelihood for a block interval to be

more than 10 minutes is 36.8%
more than 20 minutes is 13.5%
more than 30 minutes is 5.0%
more than 1 hour is 0.25%
more than 2 hours is 0.0006%
more than a day is 2.89*exp(-63)

While it is not impossible that longer times occur, it is extremely unlikely to happen.

Additional random bits I stumbled upon while researching for this question

In the last two years, the seven day average block confirmation time has never been over 15 minutes. See Bitcoin Average Transaction Confirmation Time

In the very early days of Bitcoin, bigger fluctuations were more common due to fluctuating mining power, see for example What is the longest time gap between blocks in 2010 - 2011?.

You can find a list of all block intervals up to Jan 2014 sorted by length here: Block intervals sorted.
The first column denominates the blocks forming the interval, the second column gives the block interval in seconds. Source: runeks on reddit: What is the longest time between blocks in the history of bitcoin?


Is Trust public in Ripple? If I trust someone, does everybody see exactly how much I trust them?

At some point, a public directory of Ripple addresses might emerge, and people will know exactly how much their friends trust them, compared to how much they trust their other friends which might be awkward.

Trust must be public because other people can use it. I agree, this can be awkward.

I don't see community/private credit as a major use case for Ripple in the short term because of issues just like this. But I hope that in the future, and maybe even with changes in social conventions, this may change the way people think about money.

Look at how transparent people are now on Facebook. They publicly friend people and defriend them. So it could happen.


Calculate Miners Fee before Signing Raw Transaction? I am attempting to automate the process of sending coins from multiple transactions to a single output and single change address using createrawtransaction

I am a bit lost though, because how can I calculate the output amount to the change address without knowing the total size of the signed transaction to calculate the miners fee...

For instance

I have 3 input transactions, they total 0.1 BTC.

I have 1 output address that I want to send 0.05 BTC to.

I have 1 output change address that I want to send the rest of the BTC to.

How do I calculate the amount for the change address without knowing how much the miners fee will be?

Generally, you don't have to.

The normal workflow is:

Use listunspent to identify the outputs you want to use (if any).
Use createrawtransaction to construct a raw transaction with the outputs you want to create (excluding change) and inputs you want to use (if any).
Use fundrawtransaction to let bitcoind add a change output back to itself (and additional inputs, if needed), taking the expected total size of the transaction and current feerate on the network into account.
Use signrawtransaction(withwallet/withkey) to add signatures to the raw transactions if you're satisfied with the result.
Use sendrawtransaction to broadcast the transaction on the network.

Fundrawtransaction is the key here. It will do size estimation and fee estimation for the transaction, and construct change reflecting the difference between the inputs and outputs, minus fees.

Generally you don't care about which inputs to spend, and you can also just leave the inputs list to createrawtransaction empty. In that case fundrawtransaction will do the complete coin selection for you.

The same can be done with the more modern PSBT format. The relevant RPCs then are walletcreatefundedpsbt, walletprocesspsbt, finalizepsbt, sendrawtransaction.


Calculating EMA on multiple time periods - right or wrong? I'm writing a bot that acts on market signals - currently just based on exponential moving averages. At the moment, I have the program watching the market on multiple different period lengths. For example, it will grab the last price right now, calculate and log a moving average if there is enough data, and then 60 minutes from now do the same. It can be doing this for 5min, 15min, 30min, 2h, 4h, etc. etc. time periods.

However, If I have an algorithm making decisions every 60 minutes, It could very easily lose a lot of money in between the two calculations. My thought is that I should be grabbing market data and calculating values every 1 or 2 minutes, and base those calculations on data from period_length time ago. It still obviously charts a 60 min or 2h or w/e chart, but does so every 1 min in order to react as fast as possibly to changes.

Is this the correct approach, or am I way off on this?

The normal approach is as you suggest, to update the average regularly - that's pretty much the definition of a moving average. For example Bollinger Bands are a similar metric and use a moving average which is continually updated. A true moving average would be updated with every trade made but it makes sense to break it down into periods of 30 seconds or a minute.