What should I say when I "sign" a message, to prove that I own an address? This reddit thread discusses a user who lost some coins and is trying to prove that he owns that address.

There was a question in how he signed, and what he signed in the message fields, since it's easy to become an imposter the way he did it.

Question

What should (and should not) be written in the message field to prove ownership of a particular address?

Examples might include:
- Date
- Nonce?
- ID such as Username, email address, full name, pgp public key, etc.
- To

The problem stated here is that the message signed was only four uppercase letters: "DJFC." Apparently this is the person's Reddit username, but it's also a very tiny amount of data which can often be problematic. Mathematically speaking, the more entropy in your signed message the greater confidence it inspires. Simply signing your username is also not typically enough to reasonably prove that the poster and the signer are the same person.

I would personally take a hint from the sorts of cryptographic handshakes that automated systems use. Typically these involve a server-side nonce and a client-side nonce. Each of you should choose a large chunk of random data from a good entropy source (random.org, etc), publish those nonces publicly and then sign a message which includes both nonces as well as your intended message.

Having another entity provide a nonce for you to sign is known as a "challenge" and ensures the validity of the signature by providing a large amount of input entropy that the signer can have no prior knowledge of. Including your own nonce and publishing it publicly alongside the signed message proves that the person signing the message also controls the posting account. For example:

The challenge:

twentyseventy: DJFC, please sign the following nonce in addition to a nonce of your choosing:
ff 44 45 1a 5d 78 3a 19 a8 45 cf 83 05 cf 86 a1
64 1b 1e cf 8e ad 69 3a f2 5f 6e 12 12 2e af 76

The response:

TheDJFC: I have chosen the following nonce:
96 c4 41 1a 5e 27 22 0c 64 15 6d 3e 02 ea bd e4
99 dc 47 82 ba 30 2c db 49 e2 7a bb 87 c4 5f 32

---- BEGIN SIGNED TEXT ----
ff 44 45 1a 5d 78 3a 19 a8 45 cf 83 05 cf 86 a1
64 1b 1e cf 8e ad 69 3a f2 5f 6e 12 12 2e af 76
96 c4 41 1a 5e 27 22 0c 64 15 6d 3e 02 ea bd e4
99 dc 47 82 ba 30 2c db 49 e2 7a bb 87 c4 5f 32
---- END SIGNED TEXT ----
<insert signature here>

If security is less paramount, one could perhaps forego the complexities of a nonce-based system and simply sign a much more detailed message. For example, instead of:

Message: DJFC

One could sign a message like:

Message: 2014-06-02 11:43AM PST. I, TheDJFC, in response to a request to be found at the
specified URL, sign this message as proof of ownership of the specified Bitcoin address.
Address: 1P6iT6SJe4fZkKdzZBvMGoNj4KLnpSgNSp
URL: http://www.reddit.com/r/Bitcoin/comments/273vi2/if_you_just_received_800_bitcoin_out_of_the_blue/chx4wjc

Why all this drama? Well, I can think of a half-dozen ways off the top of my head to trick someone else into signing an arbitrary message with their Bitcoin address. Without the context of a Reddit user named "TheDJFC" that four letter "DJFC" string just looks like random letters, easily confusable with a nonce. It's also worth noting that the message was only signed with one of the input addresses, while the transaction in question references multiple addresses. In such cases, signatures from all addresses used would be preferable, especially where such large amounts of money are involved.


Why does bitcoind have to listen to the public internet when supporting lnd? I have been part of experimenting with setting up a system to send and receive lightning network payments. The system uses bitcoin-core (bitcoind) and lnd. Initially, the system was set up on a home network, behind a NAT, so neither bitcoind nor lnd could listen for incoming connections from the public internet. In this initial configuration, it was possible to use lnd to send payments, but it could not receive incoming payments.
In the process of troubleshooting, we moved the bitcoind to a server outside the NAT, so it had a public IP number and opened the port 8333 for inbound connections. The lnd server is still behind the NAT, and it does not have any ports opened for inbound connections. Suddenly the system started to work and we could receive incoming lightning networks payments.
So we solved the problem, but I'm kind of baffled as to why this actually works. Was this just a fluke? Or is there a reason why a bitcoin node needs to be able to receive inbound connections in order to properly support a lightning network node?
Edit: For extra context, let me also mention that when using Electrum behind a NAT everything works fine, even though it does not listen to any public port. Which is consistent with the reply I got from @Anonymous.

Your experience was coincidental, there's no requirement for bitcoind to be listening on a public interface while using lightningd.


Bitcoin-Qt listing all Transactions as occurring at same date and time Any ideas about this one? I've imported addresses into my wallet and on rescan, all transactions come up as same date and time?

I've also had the same issue whereby importing a private key using RPC Console importprivkey will rescan and tag it with the time which the rescan takes place in btc-qt.

Even Multibit which uses the following format for private key (*.key) files is only dated such that the date corresponds to what is assumed to be the key's creation date:
Kwnononok7xQwSNIPSNIPSNIPSNIPssthcheckth1s 2013-09-18T09:42:28Z

As mentioned, the Blockchain is not being consulted for transaction history - a major flaw IMO.


Blockchain Tools for Voting Among Small Groups? I am considering starting a new co-op based business. Since the business will be member-owned, it would be nice to launch the business with a voting tool. I want to be able to propose items to the co-op members and have them vote through a transparent system. I understand that there are efforts to use the blockchain (or blockchain-esque tools) to handle voting. But all of the ones I can find are for large scale efforts (like BitCongress).

Are there any blockchain tools/approaches that can handle voting for small-ish groups? Ideally it would:

Handle voting from 300-400 people
Be able to be deployed on my own server (not a cloud-based solution)
Be simple to use for people that may or may not have previous BTC/blockchain experience

I should also add that I have the coding skills to develop my own blockchain voting tool. So if there is no OOTB solution for what I need, I'd appreciate links to whitepapers or other documentation that outlines approaches to a blockchain voting scheme.

All help is welcome.

Blockchains are a bad solution for voting, and in my opinion the widespread interest in using them for this purpose is misguided.
One of the important properties of a voting system is making sure that it is impossible for a voter to prove after the fact what vote they cast, in order to avoid vote selling or intimidation. Because of this, systems that do allow voters to prove what they voted for are in fact outlawed for government elections in many jurisdictions.
The property you want is auditability (individual users need to be able to check their vote was counted, and verify that the tally was computed correctly), but that doesn't require publication. A blockchain is however inherently a publication mechanism, and systems that rely on a blockchain to tally votes imply that everyone can see all votes.
In practice, modern cryptographic voting systems (see E2E auditable systems) actually have very good properties, without the need for publication. They rely on a central server which can see the IP addresses of the voters (but can't see the encrypted votes, and Tor can conceal IPs), let a group of trustees jointly decrypt the resulting tally, and let individual users verify after the fact that their vote was included in that tally.
But isn't that centralized? Yes it is. But decentralization is only a means to achieve a goal. In Bitcoin, we need decentralization as it's the only alternative to having a central party with transaction censoring rights. In a voting system, having a central party who can censor encrypted votes is typically preferable to allowing the whole world to see your vote (and still allow a 51% majority to censor and thus influence the outcome).
I also recommend reading Ben Adida's blog post on the matter: https://benlog.com/2017/12/28/blockchain-and-voting/


Do I need to develop a separate blockchain for my altcoin (cloned on BTC)? Hi I am looking to develop an altcoin or more specifically to clone Bitcoin / litcoin
I have few questions in mind before starting that I’d really appreciate if someone helps.
Do I need to develop a separate blockchain or it will use the blockchain of BTC / LTC?
Do I need to construct a wallet or it will be created once I compile the code?
How would I be able to mine the coins?
Where to put the code once the coin is generated

I have basic understanding of C++ and will hire a blockchain developer as well but didn’t find one here in my country (I am from Pakistan)

Do I need to develop a separate blockchain or it will use the blockchain of BTC / LTC?

That's up to you, you could fork those, BCC is an example of a forked but separate currency. Alternatively, you can start a fresh blockchain.

  Do I need to construct a wallet or it will be created once I compile the code?

"A" wallet? you need many wallets, your users will need to create wallets and not by compiling code. This question makes it sound like this is your first foray into cryptocurrency? If so this is not a good first move or a beginner project.

  How would I be able to mine the coins? Where to put the code once the coin is generated

Yeah, I think you need to do more research. This project is not a small undertaking, you should at least have some experience of mining other coins, and using coins.


What is the total number of Bitcoin transactions processed so far? Possible Duplicate:
  How many transactions have been included into the blockchain?

The question explains itself.

You can chek this and other statistics in:
http://blockchain.info/

With the available data, the simplest way is taking the number of blocks:
http://blockchain.info/q/getblockcount
and the average number of transactions per block:
http://blockchain.info/q/avgtxnumber
and multiply them. As I'm writing I get 215749*238=51348262 transactions.

The daily number of transactions is also online:
http://blockchain.info/charts/n-transactions?showDataPoints=true&timespan=&show_header=true&daysAverageString=1&scale=0&address=

You could write some code to count the transactions directly from you local copy of the blockchain, but if you want a fast figure the links I've written are enough.


My Blockchain Payment Has Been Unconfirmed For 3 Days Now Please Help https://blockchain.info/tx/342ca53d9a5dea2f63e81be6c4e39b4b3c61d6dae8b69e7e71f8c802f61da415

That’s the link it has been unconfirmed for a long time now can anyone help me please.

You can use replace by fee to encourage miners to pick up your transaction.  This should be your next step.  See here for more info:

What is replace-by-fee?

Also, here is a how to:
https://freedomnode.com/blog/75/how-to-fix-slow-bitcoin-transactions-with-replace-by-fee

This site can help recommend what you should use for your fee so that you can set your expectations of when a transaction will be confirmed:
https://bitcoinfees.earn.com/
Basically, the more you pay with a fee, the faster it will be confirmed.  The less you pay, the slower it will be confirmed.


Can I run p2pool with a thin bitcoin client? Everytime I restart my mining machine due to heat, I have to wait the following sequence to mine at p2pool:

bitcoind -> download blockchain & rescan -> p2pool -> download shares -> start mining

It took me about 10~20 minutes.

Can I substitute bitcoind with thin client (without having to download blockchain)?

*PS1. I know I can connect a remote bitcoind, but I am thinking the possibility of a thin client on a local machine.

PS2. Mining at public p2pool node is out of consideration.

No. P2Pool, unlike a normal pool, requires you to verify incoming transactions, and you can't do this without having all of the unspent transactions in the block chain.


"state channel" v.s "micro-payment channel" : are they the same? We use "micro-payment channels" such as "Bitcoin Lightning Network" or "Duplex Micro-Payment Channels" for saving transaction fee, accelerating payments, supporting better micro-payment and scaling blockchain.

Is there any difference between "state channel" v.s "micro-payment channel"? and if so, what are differences?

Payment channels are a specific form of state channels used for forwarding payments (as in the Lightning network). State channels are a more abstract idea: In theory you could use the ideas of cryptographically securing a state between two or more participants (the balance in payment channels) backed by a blockchain for something else than payments (like games). But, just as with blockchains, it is highly doubtful if this actually makes sense economically for anything else than money itself.


Is it Possible to put s9i software on an s9 The antminer s9i achieves slightly better stats than the s9 but uses the same hardware. Is their a way to put s9i software and firmware on an s9? Also I am used to the Linux operating system and flashing images etc. Would I be able to do this myself?

You need some software engineer to do so. Because its like installing a different IOS version on iPhone. You can do it but you need someone from Apple or an expert to do that. anyway, after all, you would save only 1$/m extra since the new software saving 20 watts less than s9 software that's the only difference.


Prevent rounding errors when displaying bitcoin values in javascript What is the correct way to prevent Floating Point Precision errors when displaying bitcon values in javascript? I've seen many answers on the topic, but they all seem to have their drawbacks.

Here's what I've tried:

I've chosen to store bitcoin values in satoshis, then simply convert to float on the front end using simple math. Is this correct? I'm trying to avoid float precision errors. It seems to work as intended when testing with a calculator as reference, but I would love to know for sure.

var units = {

    // In satoshis
    coin: 100000000,

    format_to: function(val) {
        // 1 BTC = 10^8 Satoshis
        return (val / units.coin).toFixed(8);
    },

    format_from: function(val) {
        // Parse the string as float the multiply * coin.
        return (parseFloat(val) * units.coin);
    }

};

Good idea on storing it in Satoshis. With anything involving money, you want to avoid floats due to rounding errors. The best way of doing this would be to parse the value in Satoshis as a string, then simply put a decimal place 8 digits from the end to get the value in Satoshis.

function convertToBTC(satoshis){
    var satoshi_string = satoshis.toString();
    var len_satoshi   = satoshi_string.length;
    if (len_satoshi < 9){
        concat_string = concat_zeroes(9 - len_satoshi, satoshi_string);
     }
    var btc_len = concat_string.length;
    var decimal_place = btc_len-8;
    var bitcoin_string = concat_string.slice(0,decimal_place).concat('.').concat(concat_string.slice(decimal_place, btc_len));
    return bitcoin_string;
}

function concat_zeroes(num_zeroes, string1){
    while(num_zeroes){
         string1 = '0'.concat(string1);
         num_zeroes -= 1;
    }
    return string1;
}


How does Open Transactions handle counterfeiting of currencies? Say I create my own currency in Open Transactions, and begin trading it on OT with other users. What prevents some user from creating copies of my currency? I'm not sure its the same situation as double spending. I'm talking about someone who doesn't have any of my money simply creating it out of thin air and selling it to other people.

In Open-Transactions, both parties have a copy of the "last signed receipt" for any given transaction.

The user forms the receipt and signs it, and then the server countersigns it.

Therefore the server cannot forge your receipt because the server does not have your private key.

When an issuer issues his currency onto an OT server, the server will have a copy of the issuer's "last signed receipt," which includes the server ID and shows the current amount that has been issued.

So the server cannot falsely claim to have a certain currency issued on that server, because the server cannot forge the issuer's signature (in the same way that the server cannot falsify your own receipt, since the server cannot forge your signature.)

The other users cannot forge your signature, nor can they forge the server's signature, nor can they forge the issuer's signature, so they cannot falsely issue units of your currency.

Also, each "last signed receipt" includes the current balance. For example, "My current balance is 100 clams. I am withdrawing 10 clams, and my new balance will thus be 90 clams." This receipt also contains the server ID, as well as the asset type ID, and must be signed by the user before being countersigned by the server. Therefore this is also true for the issuer's last signed receipt, the same as for any other user.


How can I compute mining profitability? It was asked elsewhere, but I'm re-asking the question in a less time sensitive way. Can you please list some of the techniques, charts, spreadsheets, calculators or other tools that help someone to compute mining profitability?

There are several mining profitability calculators available.  In order to obtain useful data from these, you'll need to predict how the price of bitcoins and the mining difficulty factor will change.  Price charts are available at bitcoincharts.com, and difficulty charts are available at bitcoin.sipa.be.  There are also charts of the price to difficulty ratio available at bitcoinx.com.


Differences to CCompactSize and CVarInt I'm developing a parser bitcoin core and I have a problem whit the type CVarInt, I using the decodifier mode of the CCompact size but at the block 976 I Have a problem whit the type, because the value id is unusually, so I have a question why the bitcoin core decided the change implementation to
CCompact size into CVarInt?

What was introduced in the bitcoin core versions to require a change of implementation?

Sorry for my terrible English but I'm learning.

CVarInt encoding is only used in the storage of the UTXO set internally, and never in the P2P protocol. CCompactSize is used in a number of places, including the number of transactions per block, the number of inputs and outputs per transaction, and the length of scripts.

If you're parsing block data, you will never encounter a CVarInt. If you're running into problems, it's almost certainly something else, or there is a bug in your CCompactSize decoder.


Why doesn't Multisig provide better security for hot wallets? I've recently read somewhere (can't remember the source) that multisig often doesn't provide more security in hot wallets, but increases the size and thus the fee.

I can't seem to comprehend how this can be valid (multisig not providing better security for hot wallets), what could be the reason behind this statement?

Multisig scriptpubkeys do increase the overall size of the transaction.  This is because when redeeming the output sent to the multisig script, a number (typically larger than one) of signatures have to be provided for validation in the redeeming transaction.

As for security in multisig, it depends on the setup of keys, and the scriptpubkey that ends up being executed.  For example, for a 2-of-2 multisig script (where two signers must cooperate), it might seem that this script is "more secure" against an attacker obtaining one of the keys, but if both keys are kept on the same device, then there is no security to be gained from a multisig.
On the other hand, if the script is a 1-of-2 multisig, then even if one of the keys is highly secured but the second is not, then the security in having a second signer (secured) is subverted.

Bitcoin's scriptpubkeys can be programmed to require not just multiple signers, but also conditions on when these multiple signers should participate or when they shouldn't.  We could set up a 2-of-3 (requires at least 2 of the 3 predetermined signers to participate) multisig scriptpubkey such that :

The first key is a "low" security key controlled by the user
The second key is a "moderate" security controlled by a 3rd party
The 3rd key is a "high" security key, known only to the user but is normally in cold storage and not used

In normal operation, the low security and medium security signers will cooperate to sign the user's transactions.  The user can rest easy knowing that even if their low security key is obtained by an attacker, the funds will remain safe.  The attacker will need to obtain the medium security key (the one that belongs to the 3rd party service) as well to actually move the funds.
If the service itself disappears, the user can still make use of their high security, cold storage key to complete the script with two signers, so they are never "locked out" of their funds.

There are even more ways to upgrade this setup, using ntimelocked transactions, or encoding a lock time in the script itself using op_csv or op_cltv.
I believe Greenaddress is using a setup very close to this.

So to answer your question, multisig is just a tool.  The security (or not) gained by using this tool depends on the way that it is used.


Delegated Proof of Stake (DPOS) vs. Proof of stake? What is the main difference between Delegated Proof of Stake (DPOS) vs. Proof of Stake? Is there any significant advantage for security? (since PoS in general suffers security problems.) And which DLTs / Blockchains use DPOS?

P.S. the link mentioned in THIS ANSWER about DPOS does not exist any more.

Important distinction of DPoS from PoS is that in DPoS, there is no minimum stakeholder token requirement to participate and instead of stakeholder tokens proportionately representing their ability to produce blocks, users cast votes proportional to their stake to select block producers.
The process for reaching consensus in a round can be broken down into the following basic steps.

Block producers are elected by the stakeholders in a round of voting.

Once the producers are selected, they are deterministically given a
round-robin rotation for a round of blocks equivalent to the number
of producers selected.

This creates a competitive market within the    round, ensuring
reliability.

Block producers validate and broadcast    blocks to the network.
Consensus is reached and the next round    begins.

For their services, block producers receive a reward. If they do not produce a block, then there is no reward and the reward is transferred to the next block producer if a successful block is produced. Producers do not have the ability to change transaction details, however, they could collude to prevent specific transactions from being included in blocks.
An important feature of DPoS consensus models is that the parameters of the system can be modified by the stakeholders through a voting process. These parameters include everything from transaction fees, block sizes, producer pay, and block intervals. Enabling dynamic changes of the parameters that define the model can facilitate a substantial degree of flexibility for platforms employing the DPoS model to fit the platform’s specific needs.
Advantage over POS
A distinct advantage that the DPoS model has over the traditional PoS model is the removal of the “Nothing at Stake” dilemma. This refers to the case where there is little to no cost for validators to validate on two competing chains. For validators, the strategy is the most profitable, but for the network it can lead to a double spend of a digital asset. DPoS mitigates against this due to the fact that stakeholders are using their stake to vote on block producers, not on blocks themselves. The longest chain is considered the canonical chain, so it is impossible for a subset of malicious producers to produce a fork that overtakes the main chain due to the number and order of producers being fixed before each round.


Bitcoin Core 17.0 - How to calculate balance with zero confirmations included (watch-only)? Is it currently possible to calculate balance including UTXOs with 0 confirmations, for watch-only addresses?

getbalance "*" 0 true

includes utxos with 0 confirmations only if that address has private key in the wallet. Balance from watch-only addresses is added when corresponding UTXOs have at least 1 conf.

No. Bitcoind requires at least 1 confirmation before a utxo amount is added to your watch-only address balance. Which makes sense, as it can still be trivially double-spent whilst it is not yet confirmed.

Related question: bitcoind sendfrom with minconf=0


How can I generate preimage for lightning network invoice? Should I? I'm developing API library for LND REST API.
Method POST /v1/invoices requires r_preimage parameter.
Should I generate it or LND can do it itself if I'll not specify it?
If I should do that - how to do it properly? General description would be enough.

As a rule of thumb it is probably best to let lnd generate the preimage for you.

If someone can guess your preimage they have the chance of steeling the payment. It is somewhat similar to guessing your Bitcoin private keys but probably not as bad as they can only get the current payment and technically even that might be tricky.

If you want to do it alone you should keep in mind three things :

The preimage should be truly random which for software is always hard to achieve
It should have a large enough size. Flipping a coin might be truely random but as there are only two possible outcomes one could guess / brute force those
It should be unique and never reused.

The third point is achieved in precise by following the first two points.

Also looking at BOLT 02 https://github.com/lightningnetwork/lightning-rfc/blob/master/02-peer-protocol.md#removing-an-htlc-update_fulfill_htlc-update_fail_htlc-and-update_fail_malformed_htlc you will see  that the preimage is 32 bytes of data which gives you even less flexibility than my second point suggested.


How to display a list of incoming bitcoin Transaction history in my own wallet? I have gone through various references including

How to get a history of incoming and outgoing transactions for a certain address?

Fetch list of transaction where i have received the bitcoin?

I am creating a Bitcoin Wallet,

And I want to display transaction list as a part of my Wallet.

To achieve this goal I can make a local database entry of all the send transactions which are within the Wallet.

But How can I get the incoming Bitcoin Transaction Details which are perform out side my wallet?

But How can I get the incoming Bitcoin Transaction Details which are
  perform out side my wallet?

Unless you are using bitcoin-core wallet (e.g. listreceivedbyaddress), there isn't a way to query bitcoin-core for transactions by address. To do this, you will need to parse the blockchain and create your own database indexed by address.

An example implementation that can be used for reference is Bitpay Insight: https://github.com/bitpay/insight


Bitcoin ECDSA signature in the compact format I would like to understand how to get Bitcoin ECDSA signature in a compact format, when it's exactly 65 bytes.

In the bitcoin-core repository, secp256k1_ecdsa_recoverable_signature_load is responsible for this. As far as I understand, in it r and s are separately reduced to a 32 byte representation using secp256k1_scalar_set_b32, but I don't understand how it function works. What is a EXHAUSTIVE_TEST_ORDER? Why does the resulting representation of 32b scalar remain valid after it? I would be very grateful if someone could explain it to me.

What you are looking at is just an implementation detail that you really don't need to worry about. It's just converting from an internal format (which may use different coordinate systems and bit lengths, especially for tests) to the standard output format. Within the library itself, the data in the signature may be easier and more efficient to handle when in other formats or coordinates systems. So the structures that represent that data store the data differently. However when outputting results, it must all be in a standard format, so that's what these conversions do: change from internal representation to a standard output format.

This is done for any of the signature serialization outputs that libsecp256k1 does. The compact format is just the two 256 bit values for R and s concatenated with each other. The first 32 bytes is R, the second is s. For standard compact signatures, that's it. For compact recoverable signatures (which is what you are looking at), there is an additional last byte for the recovery id.


Is there a Shapeshift service for Testnet coins to convert Bitcoins to other Altcoin testnet coins? I'm building an app and I'm working with btc testnet coins, but I want to be able to convert them to other altcoin testnet coins. Is there such a service out there?

Most testnet coins have a working faucet to obtain coins. Alternatively you can usually mine them with a CPU.


Can you use lower dual fuel electricity rates to run a crypto miner for heating with a second back up heat source? Dual fuel electricity rates are significantly lower than standard rates.  There are devices made in Russia that are specifically sold as Bitcoin mining space heaters.  Is it permitted to use a crypto currency miner for heating and thus qualify for the lower energy rates?

Is it permitted

There are certain regions (e.g. the Pacific Ocean) where everything is permitted, and certain regions where doing stuff that are allowed by law may even land you in jail.

crypto currency miner for heating and thus qualify for the lower energy rates

Yes, this is a smart thing to do wherever it's cold and mining is permitted!
Be careful, if mining is illegal, your ISP or your energy supplier may figure out that you're mining.


how to make a bitcoin buy with euros on Kraken API I am trying to use the kraken api to make bitcoin buys with euros, I am looking at the API here
https://www.kraken.com/help/api

But I am here with some doubts

("pair => "XXBTZEUR",
"type" => "buy",
"ordertype" => "market",
"voulme" => ?
)

Witch volume should I put there ? volume in BTC or Euro ?
I wish I could put euros there, but I am not sure, theres no specification on the api about this

Found how to do it, we shoud use the oflags

oflags = comma delimited list of order flags (optional):
    viqc = volume in quote currency (not available for leveraged orders)
    fcib = prefer fee in base currency
    fciq = prefer fee in quote currency
    nompp = no market price protection
    post = post only order (available when ordertype = limit)

In this case:

("pair => "XXBTZEUR",
"type" => "buy",
"ordertype" => "market",
"voulme" => '10',
"oflags" => "viqc"
)


Is Bitcoin Cash the same as Bitcoin classic? Sorry for the dumb question.

I am confused to the status of Bitcoin classic. There is a lot of support for Cash on the Classic website which leads me to think they are the same. Also I see more news for Cash than for Classic. Also, was it not true the currency acronym 'BCC' was reserved for Classic? Now I see its used for Bitcoin Cash.

What is the difference between Cash and Classic forks?

Bitcoin Cash is an altcoin, i.e. a Bitcoin-like protocol and network that originated from hardforking Bitcoin chainstate. Bitcoin Classic was first a hardfork proposal and then an alternative implementation of first the Bitcoin protocol, then the Bitcoin Cash protocol.

Originally, Bitcoin Classic was a hardfork proposal that advocated for a blocksize increase to be activated with 75% hashrate support. To that end, the Bitcoin Classic repository maintained only the set of changes necessary to introduce said blocksize increase, rebasing this on top of the latest changes of the Bitcoin Core repository. When it became obvious that there was too little support for Classic, the Classic repository started to fall behind, work subsequently being discontinued.

Later, the Bitcoin Classic repository was revived by a developer as an alternative implementation of the Bitcoin protocol. They introduced a number of other changes into this repository instead of only maintaining the code for the blocksize increase. For a while, Bitcoin Classic cooperated with Bitcoin Unlimited, e.g. with both implementations rolling out support for thin blocks. Later, Bitcoin Classic maintained an alternative implementation of the Bitcoin Cash protocol. It was recently discontinued altogether.


Wallet says “unsynchronised”, is that stopping me from seeing my bitcoins that I just received? I don't see the bitcoins I was supposed to receive today at 3PM and I tried to close the application to refresh it but it still hasn't arrived. I used GoldUX so that he could send my webmoney to my bitcoin wallet. I gave him the address that took it from my bitcoin application on my windows first.

So right now I'm seeing a wallet (unsynchronized) is this the reason why I cant see the money I was supposed to have received???

This is most likely the case. If your wallet is not synchronized, that means that it does not yet have a record of all transactions. Since synchronization happens in the order that blocks (and thus transactions) occurs, your later transactions will not show up until the synchronization reaches that point, which could take a while...

If you want to confirm that your coins went through without having to synchronize your wallet, you have at least two options:

Web-based Wallets such as BlockChain.info are connected to a backend service that is constantly synchronized. With blockchain.info, you can search for the public address to which your coins were sent without having to go through any signup process. This is probably your easiest option.

Electrum (http://electrum.org/) is a wallet that connects to servers that are already synchronized and thus will give you immediate results as well.

Also, there is a vague possibility, that this issues is caused by something other than the synchronization, so, if the options above don't work, please update the question with more details.


Value of cryptocurrencies: Why does noone make Bitcoin2, 3, 4,...? Cryptocurrency disciplee sometimes say that cryptocurrencies have just as much inherent value and potential as storage of value as fist currencies. One argument specific to the Bitcoin is that its value is guaramteed by the limited number of Bitcoins. However, I am very skeptical about this and similar arguments because of the following reasoning:

Why does noone use the exact same technology of the Bitcoin and create Bitcoin 2?  If they did, why would a Bitcoin2 be worth less than a Bitcoin? If it isn't, how can there be any worth in a Bitcoin, if there is the possibility that in five years there are a thousand different Bitcoin like system all guaranteeing the same anonymity, reliability, decentralized storage, and ease of use as the original Bitcoin? To me this is a significant difference to classical currencies which are linked to real governments and guaranteed by the fact that these governments work, pay and are paid with their respective currencies.

Why does noone use the exact same technology of the Bitcoin and create Bitcoin 2?

They have, there are hundreds of copies of bitcoin known as "altcoins", one prime example is bcash.

  If they did, why would a Bitcoin2 be worth less than a Bitcoin?

Because there is no demand for a bitcoin2. No one wants one because its not a real bitcoin. The only value bitcoin has is in the demand people have for it - how much someone is willing to pay for it.


Why is there a need for different exchanges? In laymen's terms, why is there a need for different bitcoin exchanges? Is it currently the wild west and eventually these exchanges will consolidate. Or can exchanges actually provide different value to their customers, justifying their existence. I ask  this because there are 100+ exchanges out there? Why doesn't everyone just flock to the most reputable and liquid one?

Different countries, different laws, different currencies, different banks, different payment systems.

Competition and free market.

No single central point of failure.


bitcoin-cli decodescript wrong output If I try to get info in genesis block, there is 1 tx:

  "scriptPubKey": {
    "asm": "0496b538e853519c726a2c91e61ec11600ae1390813a627c66fb8be7947be63c52da7589379515d4e0a604f8141781e62294721166bf621e73a82cbf2342c858ee OP_CHECKSIG",
    "hex": "410496b538e853519c726a2c91e61ec11600ae1390813a627c66fb8be7947be63c52da7589379515d4e0a604f8141781e62294721166bf621e73a82cbf2342c858eeac",
    "type": "pubkey"
  }

bitcoin-cli decodescript gives me this address:

{
  "asm": "0496b538e853519c726a2c91e61ec11600ae1390813a627c66fb8be7947be63c52da7589379515d4e0a604f8141781e62294721166bf621e73a82cbf2342c858ee OP_CHECKSIG",
  "type": "pubkey",
  "p2sh": "3BgShGBxRQrczVD6Ftj4z51FfgJ761FdSX"
}

However any block chain explorers show address 12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX.
The same problem with 2, 3, 4... blocks. Why?

Some of the earlier transactions on the bitcoin network use a raw public key in a p2pk script, instead of the now-common p2pkh format.

Only the p2pkh format is representable as an address. The raw p2pk script has no corresponding address, and must be worked with as a script directly. Some explorers and other tools will attempt to show it as either a p2sh address for the hash of that script, or as its p2pkh version, but that is not accurate to the actual on-chain data.


Armory paper backup without private keys Do I need to install Armory on a computer to move my BTC out of an armory wallet?

Yes. To move BTC OUT of the wallet you need to access the wallet and issue the send command (type in password if you set one) to send coins to another address.

You can send coins to your paper backed up address without having that wallet online, even if you created the wallet offline and it never touched the internet once.

This is a security design to keep your coins as safe as possible. Otherwise anybody else could just move your coins.

If you lost your keys or passwords then the coins are lost, even if you know the address.


Bitcoin cash wallet with ability to generate new addresses I'm looking for a wallet that can generate new addresses. I've seen some wallets that do generate a new receive address for Bitcoin, but I'm not sure if a new address is used when Bitcoin is sent.

I want my transactions to be not directly linked together if someone looked the Bitcoin Cash blockchain.

For that I would need to create multiple wallets? Are there any wallets that have a feature to generate new wallets?

The wallet I use, ElectronCash, has the ability to create multiple adresses. Bitcoin and Bitcoin Cash use the same adresses and private key format, so you can use your Bitcoin adresses as Bitcoin Cash adresses.

Bitcoin Cash now also uses the bech32 address format.


How can low latency and high scalability be achieved with increased block size in BTC? One of the solution to address low latency and high scalability in BTC is to increase block size.
A single block takes 10 min on average for proof-of-work. Increased block will also take same time for proof of work and network latency will be increased.
A transaction when recorded in Blockchain will become valid only after proof of work is validated through consensus. I fail to understand how will increased block size decrease time for transaction to become valid and recorded in ledger. At max, It will just allow more number of transactions in any given block.

Block time and block size are two separate things. Both of them have their own effect on scalability (if you're considering transactions per second as the key factor of scalability)

If you zoom out a little and look at the scenarios from a 60-minute point of view, a larger block size (let's say we go from 1 MB to 2 MB) allows twice the number of transactions to go through in the same amount of time. The block time for both 1 MB and 2 MB blocks remains 10 minutes, but 2 MB blocks increase the network's transactions per second (or per block, if you want to count that way) to twice the previous amount.

If in this network you also halved the block time to 5 minutes, you've effectively quadrupled the throughput of the network.

Increasing block size is not meant to decrease the minimum time required for a tx to be recorded in the blockchain. It is meant to decrease the average time taken. Since bitcoin currently has full blocks, increasing the block size means that more transactions are confirmed in the same time, thus decreasing the average amount of time it takes for a tx to be confirmed.


How does one get money into the Ripple system? How does one get money into the Ripple system? There appear to be ways how one can lend various currencies in the system, but how does one get non-debt money into Ripple?

Fiat currencies can only exist as debt. If you have them, and they're not in your physical possession, it can only mean that someone owes them to you. This is the same way it works outside the Ripple system. If you have $1,000, and you don't have physical bills, then someone (most likely your bank) owes you that $1,000.

The Ripple system uses gateways whose primary purpose is to offer debt with "withdraw on demand" agreements with large numbers of people. This allows those people who are willing to trust that gateway to use their debt as a means of exchange. The Ripple system includes automated exchanges between gateways just as it provides exchanges between currencies.

This is analogous to conventional banking. If my bank owes me $100, I can send you a check to make your bank owe you $100 more and my bank owe me $100 less. You consider me to have paid you $100 because I made your bank owe you $100 and you chose to trust your bank.


What is the significance of this red light on the Bitmain S9 board? How can I fix this issue? Is it fixable?

What are you seeing on your Antminer Status page? Is two of your boards showing 0 under the GH/S(RT) column?

Because I believe the absence of the light indicates an issue.


What's the diffrence between these two bitcoin.conf format? server=1
listen=1
daemon=1
rpcuser=X
rpcpassword=Q
rpcallowip=localhost
rpcport=Y

And
server=1
rpcuser=X
rpcpassword=Q
rpcallowip=localhost
rpcport=Y

I am a litlle confused, can these two conf file accepts solomining? And what's the difference between them?
Thank you for help

Answering the second part of your question:
server=1 tells Bitcoin-Qt and bitcoind to accept JSON-RPC commands, so you can query it
listen=1 is a bitcoin listening mode
daemon=1 starts bitcoind in the background as a daemon
rpcuser=X and rpcpassword=Q is the user/password for rpc access
rpcallowip=localhost means you can access it through rpc only from your localhost IP machine, add external IP if you want to access it from outside
rpcport=Y is the rpc port to access it (localhost:Y), for bitcoind the default is 8332
AFAIK the second config won't work for rpc, you haven't specified rpcuser, and you will see the bitcoind output in the console (not a daemon).


What informations are contained in a transaction? According to the informations that i found here: https://en.bitcoin.it/wiki/Transaction
a bitcoin transaction contains,

FOR EVERY INPUT:

The Hash of the incoming transaction
ScriptSig

FOR EVERY OUTPUT:

Value
ScriptPubKey

Now my question is: what kind of informations are implicitly contained in the ScriptSig? I know that from ScriptPubKey the destination address can be calculated, but i don't see if any other information can be retrieved from the ScriptSig.

Furthermore, if only the hash of the incoming transaction is stored, how does a node look for the incoming transaction on the blockchain, when it needs to validate the new transaction? And how does it know in which block that transaction is included?
If it doesn't know in which block that transaction is, does it have to skim through the whole blockchain just for finding it?

What data is in scriptSig

scriptSig in a typical p2pkh scenario, which is the vact majority of bitcoin transactions, only contains the public key of the scriptPubKey hash as well as the signature. This means there's no metadata other than the public key and the signature for authorizing the payment.

For non-p2pkh transactions, such as for example p2sh transactions, more data is included in the scriptSig. For example in p2sh multisig, the multiple public keys capable of authorizing the multisig will be revealed. In even more complicated scripts, the scriptSig may reveal significant information, depending on what the scriptPubKey script is requesting. For example, there are snowflake transactions that require scriptSig to be solutions to certain puzzles. However, these transactions are very rare.

How transactions are validated

There are multiple security models in validating a transaction. Transaction validation is a different notion from transaction confirmation which you are talking about. Transaction validation asks whether a transaction is valid – for example, it is of the right format, it follows Kirchhoff's Law (i.e. sum of outputs is less than sum of inputs), and the outputs it spends have not been double spent. Validating a transaction requires access to the current UTXO.

Transaction confirmation on the other hand validates that a transaction has been buried under a certain amount of proof-of-work, for example k = 6 blocks. Checking the confirmation status of a transaction does not require traversing the whole data in the blockchain. It only requires looking at the blockchain headers.  In the SPV security model, the transaction confirmation status is checked simply by checking that it was included in a block and buried under a certain amount of proof-of-work. This is done quickly without looking at the whole blockchain data (but just all of the blockchain headers) by providing a proof-of-inclusion which consists of Merkle tree path siblings.


Get "Value at time of transaction" from blockchain.info api I need to get the value displayed in usd on the transaction details page of blockchain.info, if you hover the btc sent you can see a "value at time of transaction".

How I can get this data programmatically so I can use it to track history of transaction prices on an address? I've searched all over but can't find where to get the price shown in blockchain.info for my tx.

This is an example:
For transaction: https://blockchain.info/tx/a11d6b6de30b5f1a5090c0f9d4b91fcf0e1384b86dd78614301bc46080d74366

If my address is 158n3kPsg822Ci5131ToyYsM66gnwcCzKm,
I need to be able to retrieve programmatically the 2079.7 value as shown on the transaction page.

I inspected the network calls and found this endpoint: https://blockchain.info/frombtc?value=499987100&currency=USD&time=1449868758000&textual=false&nosavecurrency=true

it returns exactly what I need.


Should we still mine nowadays with CPU/GPU? For the little bit I understood so far about the mining process, it seems to me that "finding" a block is very very very difficult for a CPU/GPU.

However, since it is done by brute force, it seems to me that there is a very small chance (has anyone calculated how much?) of a single cpu miner to find a block very fast in a few first tries, hence hitting the jackpot of 25 BTC.

Is this theory correct?

it is now impossible for normal CPU/GPU to mine bitcoin, you need to get some ASICS or Gpus (e.g Rx480) and mine in a pool. of course you should buy devices with high Hashr power to increase your chances to get rewarded. Here is a simulator to check the potential profit you could make by determining your hash power : https://www.cryptocompare.com/mining/calculator/btc

some details about the mining pool and the network hashrate :

https://btc.com/


Is it possible to trace fraud committed via a service the bridges banking and bitcoin? Consider the following scenario:

An individual, the "buyer" buys something online from someone else, the "seller". The buyer cannot verify the identity of the seller.
The seller wants money upfront before shipping and communicates bank account details to the buyer. The buyer trusts the seller because he assumes the seller can be identified using via the banking details if the seller should attempt to defraud the buyer.
However, the bank account is not a personal account in the seller's names. It's a service that will convert all incomming funds into bitcoin and sent them to a bitcoin address under the control of the seller.
The seller runs away with the money (bitcoin) and never ships the goods. The buyer attempts to track the seller using the banking transaction and finds out about the service used. The service operator discloses the bitcoin address (e.g. when law enforcement gets involved), but cannot provide any further information about the seller.

Is is possible to track down the seller using publicly available information from the blockchain?

It may be feasible to trace amounts sent to the scammer's address, but it would require a lot of work, mostly communication to strangers, to pin an identity to an address. This difficulty would be further exacerbated by the employment of green addresses, mixing services, or simple holding.

Bitcoin is pseudonymous, meaning that tracing is only as easy as the person being traced allows it to be.

Bitcoin is not fungible, meaning primary that a "coin" is not uniquely identifiable. Rather, it's a distributed leger system, with value being subtracted from one account and added to another in each transaction.

The only traceable entities are thus the accounts receiving and sending, and the only relation to the physical world in each transaction is an IP address. Given the employment of an anonymizing service such as TOR or a lower-anonymity proxy, tracing that IP address to a physical location with a person is highly improbable (if you figure out how, I'll bet you could make a lot of money from governments!)

If you're still up for it, BlockViewer may assist in the tracing.

As an aside, it's pretty safe to say that any BTC sent would require nearly Herculean effort to reacquire. It would most certainly necessitate the involvement of law enforcement, which has not likely yet been trained how to deal with digital currency investigations. This highlights the importance of a third-party escrow service or a personal relationship between the buyer and the seller.


What are "leaf versions" in Taproot? What are "leaf versions", when do you upgrade a version, how many versions are there and how do they differ from segwit versions?

SegWit introduced versioned witness programs. When satisfying a script to spend coins you need to provide a redeem script consisting of a version byte and a witness program. The version introduced with SegWit was version 0 (zero).
The Taproot proposal uses this SegWit versioning system by introducing spending rules for version 1. The witness program to satisfy a Taproot spend will be version 1.
The Taproot proposal also introduces a new versioning system in addition to SegWit versions called leaf versions. Each leaf of a Taproot tree will have its own leaf version. This is a version for spending rules from that particular leaf. The leaf version introduced with the Taproot proposal is version 0.
So in answer to your question there is just one leaf version with the Taproot proposal and a new SegWit version (to make two SegWit versions in total). The versions are there for future upgrades and as a user you do not need to upgrade anything like you might say upgrade the "version" of your Bitcoin Core software.
Remember that Taproot is still a proposal at this stage (July 2020) and so at the current time SegWit version 1 and leaf versions are not relevant to any transactions you might make on the Bitcoin network.
[darosior edit: There are 41 possible leaf versions (including version zero) for future upgrades as outlined in BIP-Taproot]


How to generate the digest from a raw bitcoin transaction for verifying signature of specific input? I'm writing a stand alone process that needs to verify that a known UTXO is part of a new transaction with a valid signature.

Inputs [ UTXO, raw transaction, input_number ]

How do to I verify the signature for this specific input?

As I understand, depending on the SIGHASH, I would need to parse the entire transaction and replace/remove some data. However, the length bytes seem to make the entire process extremely complex.

Does a segwit transaction make everything easier? Or are there still bytes that need to be removed depending on SIGHASH?

On a side note. in general, will APIs that return "raw transactions" no longer have the signature data for segwit transactions? or are they all appended to the end?

However, the length bytes seem to make the entire process extremely
  complex.

Not very complex. Here is a piece of my code for generating digest for standard non-segwit transactions and sighash_all inputs (I do not need and have not tested other hashtypes).

const MyKey32 Transaction::getDigest ( const int n, const QByteArray& scr ) const
{
  MyByteArray data;                                 // create empty array
  MyStream stream ( s );                            // source transaction is a stream
  data.putInt32 ( stream.readU32 ( ) );             // version
  data.putVarInt ( stream.readVar ( ) );            // input count
  for ( int i ( 0 ); i < inputs; i++ )              // copy all inputs
  {
    data.putArray ( stream.readAdvance ( 36 ), 36 );// copy 32 byte hash as is + copy 4 bytes index
    data.nop ( stream.skipVarData ( ) );            // skip original script and do nothing
    data.putPrefixedCond ( i ^ n, scr );            // script replacement: empty or given in param
    data.putInt32 ( stream.readU32 ( ) );           // sequence
  }
  data.putVarInt ( stream.readVar ( ) );            // output count
  for ( int i ( 0 ); i < outputs; i++ )             // copy all outputs byte-by-byte
  {
    data.putInt64 ( stream.readU64 ( ) );
    data.putPrefixed ( stream.readVarData ( ) );
  }
  return data
      .putInt32 ( stream.readU32 ( ) )              // lock
      .putInt32 ( SIGHASH_ALL )                     // append hashcode
      .sha256d ( );                                 // double-sha256
}


Unconfirmed transaction for 6 days now. Please help I have an unconfirmed transaction that has been sitting there for 6 days now. Any assistance would be greatly appreciated.  Thanks.

https://blockchain.info/tx/98d4fee15e8eab8b78237a7b2eda8c62aa7c43a2e157b09ed4ee5b944092da6d

Cheers

Hoowee

You can probably use CPFP to add a massive fee and get it mined.  Essentially, you spend the unconfirmed transaction in another transaction (to yourself for example) and just use a really big fee.  Eventually a miner will want to mine both to get the fees.


So how would someone steal coins from my site? Nearly every attack I've ever read about has involved bad website coding in one fashion or another. Like that that attack on the Doge wallet site in December, where they allegedly injected the website, and got in through a quirk in Apache to modify the source code, which allowed the alleged crooks to allegedly modify the destination of the transactions by replacing a variable with a hard coded address, that led to their wallet --thereby stealing new transactions and withdrawals. It's been the same or similar with most other attacks on sites that store wallets on the server that I've read about.

So the importance of coding a secure multi-tiered website is very important. I need to watch for injection attacks, apache permissions issues, and open ports, and all the usual stuff I would watch for on a site where money is changing hands. Got it.

But is it always poor website coding that causes site owners to lose money? Is there anything a potential vandal or cracker can do in order to compromise my site in other ways? Also, is there a whitepaper on building bitcoin protocol empowered websites securely, anywhere?

Thanks in advance for your time.

You should assume your site is going to be hacked, and design with that in mind.

Blaming things on "poor coding" is a get out. There will always be bugs. You must be sure your procedures, your protocols, are faultless despite these bugs.

The majority of bitcoins should be in offline storage, and your hot wallet should be on its own dedicated server, with access through some kind of very limited API that does sanity checks and rate limiting on everything. (Access could be through a custom and very carefully written daemon i.e. not just some Apache HTTP API with associated vulnerabilities!)

Ideally, the user owns an encryption key that is used to somehow client side sign transactions (or any other action they take) which are applied to their account or the hot wallet.

Even then, a hacker could presumably hijack the serving of your pages, modify the crypto etc to steal their key. But at least if the user's key was only generated once and is only used by them occasionally, the chance for massive theft is reduced. Two factor auth may help too.

You could have daemons on other hidden servers that regularly check your site and its resources for tampering, suspending everything if necessary. Perhaps release a browser add-on which verifies your site. Your entire site could be signed, and the add-on could request a new signature to verify any changes. (And you perform this signing offline). As long as the user's browser or the add-on publishing system doesn't get compromised, you'll be alright ;)

To summarise all that:

client side encryption/authorisation of any action a user can take
this simply tunnels through the terribly insecure WWW/apache etc layer to a very limited access highly secure "hot wallet" server
some way of verifying that client side encryption is not compromised, e.g. watchdogs running on IPs unknown to attackers
(and lots of other watchdogs all over the place which halt service at the slightest cause for concern)

You'll do all this and then your hosting provider will be compromised by social engineering.

At the end of the day, all said and done, your most effective protection will be the offline cold wallet with manual (and slow and annoying) transfers of customer's funds, and regular audits to check all funds are actually there (mtgox lol).

btw, this is written by somebody with no background in security, imagine what somebody who did have such a background might write ;)

Final point: If you are thinking of running a wallet service, don't. Just don't. Give up now. It's going to end in tears, and death threats.


bip44 account discovery In Bip44 "Account Discovery" section, there is following sentence:

  We scan just the external chains, because internal chains receive only coins that come from the associated external chains.
  (https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki#address-gap-limit)

I do not understand it. If I do not scan internal chain, how will I find the change addresses?
Yes, change address will exist in transaction output of public (external) addresses, but I can not find out which output address is change address as it can be real receiver address.
Thanks for help.

In terms of "Accounts discovery" algorithm, it is not needed to get internal addresses. We just sequentially take receiver addresses of an account and check whether one of them was used in any transaction. Literally: we get a transaction and check whether receiver address is in the set of target addresses of looking transaction.

This is so because if there is a change address in the transaction then there is a receiver address mandatory. It allows us to skip checking of change addresses for this task.


jsonRPCClient Error with php variables I am trying to run the following code

$betamount=$_POST['bet'];
$litecoin->move($myusername,Admin,$betamount);

but it will not work. it does however work when i replace $betamount with an actual number ie

$litecoin->move($myusername,Admin,0.2);

or

$betamount=0.1;
$litecoin->move($myusername,Admin,$betamount);

any ideas on whats going wrong ? the $_POST['bet'] is defiantly a number because i have tried multiplying in php and it all works fine.

Fixed this now, All you have to do is change it to this

floatval(trim()) ie ...    $betamount=floatval(trim($_POST['bet']));

for numbers

and this

and just trim()  ie ... $litecoinaddr=trim($_POST['address']);

for strings


Who is liable my case or is it a classic hack? Recently i purchased a Bitcoin from BITX, the South African Exchange for bitcoin. I purchased 28 Bitcoins from BITX. When they sent me the 28 Bitcoins to my Blockchain iOS app, the Bitcoins were in my wallet for exactly 1 second before they were sent to another address. My concern is that my private key was generated offline. Im the most paranoid person when it comes to security. i keep everything extremely safe AND clean. A hacker would need more than just 1 second to hack my address AND re-transfer the money. I never received an outgoing funds transfer email from my Blockchain App. who is at fault BITX or Blockchain?

If the blockchain shows the money was in your account, then they have fulfilled their requirements. At that point, any transfer of money OUT of your account needs to be signed by your private key. This signed transaction is what is in the blockchain.

The most likely situation is that the application you used to generate the key generated a weak key. If, for example, there is a flaw in your key generation that is likely to generate one of only, say, a billion private keys, then someone could work through each of those billion keys, work out the hash, and store it in a table. They could then monitor the incoming blockchain for payment transactions, and look up the hash in their table. If they find a matching hash, they look up the related private key, and put through a transaction. A billion keys and their hashes would take about about 100GB - and if they get 28 Bitcoins, that makes it all worthwhile.


Synchronizing with network I transferred some bitcoin to my bitcoin core wallet, at the bottom it is still showing "Synchronizing with network" and my funds have not yet appeared. Did transferring funds to my wallet before this process was complete cause my funds to not go through? The site I transferred from did say successful transaction. Will my funds show up after the synchronizing process is complete?

I transferred some bitcoin to my bitcoin core wallet, at the bottom it is still showing "Synchronizing with network" and my funds have not yet appeared.

That's normal. If your transaction is included in block 100, then you won't see that transaction until your Bitcoin client downloads block 100. That means that you won't see it until your client is almost done with synchronization.

  Did transferring funds to my wallet before this process was complete cause my funds to not go through?

You can send Bitcoin to an address made by a client that is not done synchronizing. Your client cannot tell you what your balance is, but the balance exists anyway. Once synchronized, the client will show the money, if there is any.

  The site I transferred from did say successful transaction.

That doesn't necessarily mean that the transaction was successful, or that the transaction exists at all. They can say whatever they want.


What does the "Cost per Transaction" chart on BlockChain.info show? According to the Blockchain.info: Cost per Transaction, the latest "Cost per Transaction" value is 16 USD. Apparently, it's not the transaction fee, what does it mean then?

On the chart overview page you find the description "Cost per Transaction: A chart showing miners revenue divided by the number of transactions.".

Meaning, it's the total value of the block reward of a block divided by the number of transactions confirmed on the network in that block.

Here is an example with made up numbers:

Block reward is 25 BTC + 0.1 BTC in transaction fees.
There are 502 transactions in the block.
Current exchange rate is 367.3 USD/BTC.

25.1 BTC / 502 transactions = 0.05 BTC per transaction

367.30 USD/BTC * 0.05 BTC per transaction = $18.37 per transaction

Concerning what will happen after the regular block reward is reduced/discontinued, check out:

Will Bitcoin suffer from a mining Tragedy of the Commons when mining fees drop to zero?
How much will transaction fees eventually be?
What happens once the mining reward gets cut in half?


I'm trying to hash transactions together to find the Merkle Root! Transaction #59500 has 045c670f1c02c919  as its coinbase. Transaction 1 is 6653ad77d695752cff9fe63bbb5702a53807be534c537251d53de06aac5ca093. Transaction 2 is 72e8781092c01e9eb1c21ba33d52ad6abc42f3807601bcd8b8074d583446346e.

Double SHA256 of Coinbase

import hashlib
header_hex = ("045c670f1c02c919")
header_bin = header_hex.decode('hex')
hash = hashlib.sha256(hashlib.sha256(header_bin).digest()).digest()
hash.encode('hex_codec')
'6eafdb5c504ed7e70536d70c666503f4435205f367f21d2960ff2262ca2acf0b'
hash[::-1].encode('hex_codec')
'0bcf2aca6222ff60291df267f3055243f40365660cd73605e7d74e505cdbaf6e'

Double SHA256 of Transaction 1

header_hex = ("6653ad77d695752cff9fe63bbb5702a53807be534c537251d53de06aac5ca093")
header_bin = header_hex.decode('hex')
hash = hashlib.sha256(hashlib.sha256(header_bin).digest()).digest()
hash.encode('hex_codec')
'b2e28ac8528477c0c3c7978ee29479ae9ca1aed9cb2e58e6b910f17142f6c53d'
hash[::-1].encode('hex_codec')
'3dc5f64271f110b9e6582ecbd9aea19cae7994e28e97c7c3c0778452c88ae2b2'

Would I then combine the double hash of the coinbase with the double hash of transaction 1? Like so:
("0bcf2aca6222ff60291df267f3055243f40365660cd73605e7d74e505cdbaf6e" + "3dc5f64271f110b9e6582ecbd9aea19cae7994e28e97c7c3c0778452c88ae2b2) and then double hash that?

The double hash of the coinbase and transaction 1 is d77fefa4fd82afdf1780f84dae5dc30be2f3b53bc8db2c40db6d17687324dc48

Double SHA256 of Transaction 2

header_hex = ("72e8781092c01e9eb1c21ba33d52ad6abc42f3807601bcd8b8074d583446346e")
header_bin = header_hex.decode('hex')
hash = hashlib.sha256(hashlib.sha256(header_bin).digest()).digest()
hash.encode('hex_codec')
'c9f7032f5df64761e74ad4bc7cb653db8c78aed331926382ca37ec3b8d8625a9'
hash[::-1].encode('hex_codec')
'a925868d3bec37ca82639231d3ae788cdb53b67cbcd44ae76147f65d2f03f7c9'

Would I then hash a925868d3bec37ca82639231d3ae788cdb53b67cbcd44ae76147f65d2f03f7c9 with itself?

header_hex = ("a925868d3bec37ca82639231d3ae788cdb53b67cbcd44ae76147f65d2f03f7c9" + "a925868d3bec37ca82639231d3ae788cdb53b67cbcd44ae76147f65d2f03f7c9")
header_bin = header_hex.decode('hex')
hash = hashlib.sha256(hashlib.sha256(header_bin).digest()).digest()
hash.encode('hex_codec')
'4075e4ac60dd8a52ed3eb69520ad71d660c8c2bcbf4073c87fd633a276cb2921'
hash[::-1].encode('hex_codec')
'2129cb76a233d67fc87340bfbcc2c860d671ad2095b63eed528add60ace47540'

Lastly when I try to combine that hash of the coinbase and transaction 1 with the hash of transaction 2 with itself...
''d77fefa4fd82afdf1780f84dae5dc30be2f3b53bc8db2c40db6d17687324dc48' + ''2129cb76a233d67fc87340bfbcc2c860d671ad2095b63eed528add60ace47540"

I got this 012853eb35789c270fc72dc11b4b9e24710f6f02793344860bdcad7f25e771e1 when the merkle root is :

ff682ef66cd1b56213fd4db9462fb138f6d8c16d706d41969a7eacc819528038

What did I do wrong?

There are multiple things that you have done wrong.

First, you hashed just the coinbase part of the coinbase transaction. You are supposed to hash the entire coinbase transaction.

Second, you have hashed the transaction ids of the transactions, not the transactions themselves. Hashing the transaction themselves will result in the txid (ignoring segwit). So instead of hashing the txids again, you just take those as the first hash in the merkle tree and combine them and hash the combination for the second level of hashes.

Third, you reversed the hash hexadecimal representation. You should not be reversing those hashes. However, if you start with the txids instead of the transactions themselves, you need to byteswap the twids first. Byteswapping is different from reversing the hex of the string as two hex characters represent one byte. It is easier to do this when the hex has already been decoded into a byte string.

For combining hashes, you just concatenate them. For the last transaction, if it is by itself, you copy its hash and concatenate the copy to the original. It is just the txid concatenated to itself.


How to recover private key if I have the 12-word and an address? 5 years ago I created a Copay app, and I can not import it or recover it. I have the 12 word all the address. Leftover money stays there. But I can not import anymore with Copay. Something wrong, I do not know what.

Add 12 words (the seed) on another wallet, electrum (https://electrum.org) for example.


How do I get a vanity address from a hierarchal deterministic wallet? I'm interested in finding different techniques that can be used to create vanity addresses with a BIP32 address.

For example, can any of this computation be offloaded to a dedicated server, or a 3rd party?

You can do this but the advantage of HD wallets effectively diminishes. You can simply brute force by iterating over all the indices of the HD wallet until you find one that has the vanity characteristics you want. However, its possible that it is sufficiently hard enough to find that you will have to save off the private key anyway.

The entire point of HD wallets is that you only need the master private key/seed to generate all your addresses. If you end up with an index that so far out from the last used address, you might not be able to find it in the future without also having saved the private key for the vanity address.


How to query all utxos of an address from a full node? I am new in the blockchain field, and I am trying to build my own block explorer from scratch to really learn about Bitcoin. I am currently running a full node in a raspberry pi, and I have already decoded the chainstate/UTXO-set with a levelDB library for Node.js. The content of this database is not exactly what I found in the documentation around, but led me well enough to fully decode this database.

Basically, the keys are the transaction ids with the index of the output, and the values contain the height, wether it is a coinbase transaction or not, the amount, and the address (before the base58 encoding) of every utxo.

However, I don't really know how to query this database in an efficient way to get all the utxos for a specific address without scanning the whole chainstate. It took me about 10 minutes to get all the utxos of a single address which is totally unacceptable.

I guess my specific question is how do I query this database through the values instead of the keys? Or if there is a better way to do this, maybe through the blockchain itself? maybe to an RPC bitcoin-cli call?

There isn't really a way to do this efficiently, as Bitcoin Core is not designed for that.

You can search using the the scantxoutset RPC command, but all that is doing is iterating over the entire database and returning matching entries (it's more powerful than just by address though; it can for example search for an xpub + derivation path too).

There is some work around adding support for an optional (and separate) address-based index to Bitcoin Core, but that will at the earliest be for v0.21.

Other than that, there are a number of other software packages that can build such an index (independently from Bitcoin Core).


Are there projects visualizing and analyzing historical transaction data? I know blockchain.info etc, but I'm looking for things beyond simple timelines of transaction volume and the like. I was thinking towards scientific projects that aim at discovering patterns in the historical data, for instance:

are there addresses that accumulate large amounts of btc?
are there interesting transaction pattern, e. g. prolonged transaction "ping pong" between address pairs, "star patterns" where a single address sends out transactions to a large group of others, etc
are there amounts that seem to get passed on along a long chain of addresses?

Note that those are just examples I made up to illustrate what kind of angle I'm looking for: a more open-ended, scientific analysis rather than trading advice. That same notion makes it hard to search for projects, so I'm hoping that someone might happen to know something.

Check this website. It has summary of the tools available http://block-chain-analysis.com/


Bitcoin Core forgot Passphrase I opened my bitcoin core wallet for the first time in nearly 7 years and do not remember ever setting a passphrase. The good news is I've got bitcoins in the account that I'd forgotten about, bad news is that without the passphrase, I can't send them anywhere to cash them out.

Is there a way to access / hack the passphrase for Bitcoin Core?

So you have bitcoin-cli installed on your local computer? Does the command bitcoin-cli dumpprivkey "address" of an address you know related to the wallet lead to the private key you need?


Why doesn't Butterfly Labs use their ASIC machines for their own mining process? Butterfly Labs produces ASIC hardware for bitcoin mining. I guess it is cheap for them to produce a 1500 Ghash/sec machine. They could have many of them for a very reduced price. Why, instead of selling them, do not they use them for their own mining so they get more money?

They are choosing a less risky option.  By selling now, they get the price of the machine no matter what happens to the BitCoin economy.   They are defining their core competency as being in the hardware business not the cryptocurrency business.

The same could be said for people selling pickaxes during the Gold Rush.  Why not use the pickaxes to mine gold?  They got the money for the pickaxes up front, then they were out of the picture.  They didn't have to choose a place to prospect and worry about how long the gold would last. They chose to be in the pickaxe business not the mining business.  Incidentally, during the Gold Rush it was these peripheral entrepreneurs that made much more than your typical gold miner.


BlockChain API playground OR SandBox? I am android developer. I have used https://blockchain.info/api/blockchain_wallet_api API for my application But the problem is now how can I test my application (transactions) with out having bit-coins in my wallet. Is there any play ground or SandBoxing for testing specific for BlockChain wallet API?

Thanks

Blockchain.info does not have a sandbox nor testnet support.


Is there a miner with a controllable hashrate? Sometimes people don't want to mine at a full load due to various reasons (computer noise, hardware concerns, etc). Are there any miners out there in which one can set a hashrate limit? I know one can use -f and -s flags, but the amount of control they give is quite limited.

I suggest you run the miner at full load but decrease GPU core clock speed (GPU mem clock speed should always be reduced) and even more important GPU voltage.

Reducing GPU core clock speed should reduce power linearly. Also it allows you to decrease voltage further which reduces power quadratically. Doing so you can reduce noise dramatically.

If you use cgminer you can underclock and undervolt from within the program itself. If you use another miner you can use a program supplied by your graphic card's manufacturer (e.g. MSI Afterburner, atifonfig on linux) or a third party software such as AMDOverdriveCtrl (Linux). There is also my very own windows command line tool clocktweak (not free).


How are transaction fees collected in Bitcoin? I'm looking into the structure of blocks in the Bitcoin blockchain, and I can't figure out when\how the fees collected by miner of the blocks are transferred to the miner.
According to what I can tell they are not a part of the coinbase transaction (which as I understand has to be constant since changing it after discovering a block would change the hash of the block).
Are the fees paid as separate a transaction? Are they written directly to the UTXO without appearing on the blockchain? Something else?

Thanks!

The coinbase transaction itself has the subsidy/coins for mine a block + all fees of the transactions of that block.


Support sending bitcoins using webpage URL? Are there any Bitcoin clients or services that support sending bitcoins to a HTTP(S) URL instead of having to enter a Bitcoin address directly? (e.g. for donations)

Webmasters could include their Bitcoin address in a link element in each page (same for the whole site or different for each page, e.g. to account which page generated which donation):

<link rel="payment" href="bitcoin:…" title="Donate bitcoins, if my article was of help to you">

The href attribute should contain the Bitcoin address, using the bitcoin URI scheme.

The rel attribute should have the value payment. It’s defined as:

  RelPayment is a microformat for making exchanges of support (be it financial or otherwise) possible. By adding rel="payment" to a hyperlink a page indicates that the destination of that hyperlink provides a way to show or give support for the current page. For example to give financial support to the owner of the current page.

The (optional) title attribute could contain a small note, e.g. what the donations are used for, or who exactly would be the receiver etc.

Tools (Bitcoin clients/services, browser add-ons etc.) could extract the Bitcoin address by looking for a link with the link type payment whose URI uses the scheme bitcoin.
If one enters a webpage URL that hasn’t linked a Bitcoin address, the tool should throw an error. For security reasons probably only link elements should be parsed (instead of a/area), otherwise e.g. commentators could include their own Bitcoin addresses.

The client Electrum seems to support something like that (using a different method): Aliases:

Aliases may be server names (e.g. ecdsa.org) or email-like addresses (e.g. john.doe@ecdsa.org)
The corresponding Bitcoin address is retrieved by the client, using a descriptor located at a canonical url.
Aliases may be entered in the Electrum client, or used in Bitcoin URIs […]


What happens if 1-way functions no longer exist? Advances in AI and nanobiotech  can radically increase intelligence to the point where unsolved mathematical problems get solved.

What happens to Bitcoin (and other cryptocurrencies) if ⨕ 1-way functions cease to exist?

without modifications the current bitcoin system would simply be compromised.

it seems very likely all private-public key cryptography would be compromised as well, and society as we know it would change.

however, given unknown advances to begin with, there is always the chance that something entirely different could replace the current system of secrecy when it comes to trust.

there is also the possibity that no matter how many advances we get, 1-way functions might be impossible to completely break, or that we find new maths that guarantees breakage if any 1-way function but with a cost that is prohibitive.


Bitcoin.conf not being read by Bitcoin Core My issue is I cannot get RPC working with Bitcoin Core. I do not know what I'm doing wrong! When I first installed Bitcoin Core it did not come with a bitcoin.conf file so I created one with the following details:

server=1
rpcuser=root
rpcpassword=password
rpcconnect=127.0.0.1
rpcport=8332

That's all I have in there. And yes my Bitcoin Core client is in sync with the bitcoin network.

I've also checked my router and it is UPNP enabled and I literally see the port in my router's configuration open. The port is: 8333

And it is the only port open. Do not know if I need 8332 open. Please shed some light on this for me. What I am trying to accomplish is to get PHP to interact with bitcoind such as generate a new bitcoin address.

The answer was to simply move bitcoin.conf in the correct directory, as described here: Where is the data folder for Bitcoin-Qt?
Also, don't forget to set the correct file permissions as well; bitcoin.conf should be owner read-only!


How do offchain transactions get validated/confirmed whilst using Lightning network? How do offchain transactions get validated whilst using Lightning network?

Individual transactions on the lightning network will never be confirmed on the blockchain.

However, the net sum of value passed back and forth on a single channel (regardless of how many lightning transactions that is) will be validated on the blockchain as part of one closing transcribe for the channel.  This is similar to how money is transferred in the traditional financial system using a process called "deferred net settlement".


Nicehash autoselected algorithm with very high difficulty I'm new at this so please bare with me

I have a couple gtx 750 lying around so I decided to give mining a try.

I used nicehash, according to the site "NiceHash Miner autoselects the most profitable algorithm for your GPU/CPU".

Nicehash autoselected Cryptonight for me. With 80,000 Diff

While observing the result, I noticed I get "yes!" / "yay!" only every after 5-10.

I tried to used other algorithms such as NeoScrypt and it gives "yes!" / "yay!" every 2 mins.

BTW neoscrypt only has 32-64 diff

So my question is which algorithm should I try?

Difficulty isn't the only factor in choosing which coin is most profitable. NiceHash may have selected Cryptonight because although you will mine fewer blocks, each block is worth more, so you will make more overall.


How can I accept bitcoins on my website? I have an online store and would like to begin accepting bitcoins.  How can I go about doing this?

There are a number of ways one can go about accepting Bitcoin on a web interface. Keep in mind as you review these options that Bitcoin is still a young technology and many of these options aren't what you'd call "friendly" just yet. That said you do have quite a few options depending on your level of expertise and technical requirements:

Use a service like:

BitcoinPayFlow
BitPay

Use an existing shopping cart interface

There are existing plugins for Ubercart, Magento and many other popular e-commerce platforms. If you are looking to modify an existing site that happens to run on one of these platforms, this may be your best bet. If you've yet to start a site and don't want to write code yourself this may still be your best bet since you can choose your platform prior to implementation.

Roll your own using existing libraries

This is your best bet if you're using a platform that isn't currently supported or if you have difficult integration requirements that cannot be satisfied by existing e-commerce platforms like Magento or Ubercart.
Languages:

ASP.NET/C#
PHP
Python
Many others

Roll your own using the JSON API directly

This is only necessary if you are not using one of the half-dozen or so languages that already have pre-written libraries for interfacing with bitcoind. The list of languages may be short, but all of the major industry standards have been covered, so it's unlikely you will have to go this far.


Problems in recovering from a seed of Multibit HD I've installed and created a new wallet in Multibit HD on my PC, I used a seed of 24 words. As far as I understood, with this 24 words I can recover it on a mycelium android, and I should see and be able to spend the bitcoins from both devices.
The problem is that after fresh installing the mycelium on android I choose to recover from seed, enter the 24 words but I can't see my bitcoins. A new wallet with 0 bitcoins appears.
Is it normal? what i don't understand about HD wallets? I thought that both wallets shold be identical.

The default MultiBit HD wallet uses an address generation scheme known as BIP32. Mycelium uses an address generation scheme known as BIP44.

BIP44 is what Trezor uses.

HD wallet interoperability is unfortunately a bit thorny. It's normally easier to have two wallets.


Can i combine 2 devices to get more power for mining As An example lets say i have 2 USB Miners each one has 16 GH/s
can i combine these 2 to mine with 32 GH/s ?

And if yes pls tell me how.

Yes. To do this simply mine with both at the same time. A mining pool will never give out the same work twice. So mining with two 16 GH/s devices will be the same as one 32 GH/s device.

If you mine at the same mining pool with both then the pool will show you mining at 32 GH/s.


Possibility of validation of transaction TX id I've readed numbers of thread here but non answer to my question. What I want to know if there is a way somehow to validate transactionID ( txID ).

I have a site which accepts bitcoins. In order to validate payments I ask customer to submit txID which I use to look up the transaction. The problem is that customers sometime submit wrong txID, not full txID .. etc.

Is there a way to validate transaction ID WHEN USER SUBMIT IT TO THE FORM and if is correct then save it and check it?

A txid is little-endian representation of the double sha256 of the serialized tx. Hence, if they send you a wrong or incomplete txid there is no way of validating it without the serialized tx.

Moreover, you should be careful when identifying txs just by its txid, if not careful enough (you accept 0-confirmation txs, or txs that has not gone deep enough in the blockchain), they could double spend the same utxo thas has been used to pay you.


After 21 million bitcoins After 21 million bitcoins miners will be paid certain transaction fees but I need your guidance for clarifying following confusions:-

Currently solving a block gives you 25 bitcoins but what is the
reward level after 21 millions bitcoins?
I understand we still need sufficient amount of verifying computing
power to secure the network even after 21 million bitcoins but do you think people would invest in
powerful machine just to process transaction where the reward level
is lower then the power consumption?
What if  bitcoin community decided to mine for other alternatives
such as litecoin, dogecoin for greater rewards, don't you think it'll
effect the value of bitcoins?
Do we still have power competition to process transaction?

Thank you

If this happens, you are likely talking of the years following 2140.  If bitcoin survives, it is very possible that bitcoin will be worth millions of dollars.  If so, then perhaps single little satoshis will be worth cents or perhaps what we perceive of as dollars.  Especially if bitcoin is used to supercede as the most common method to use currency.  However america would have to lose a lot of value and do something mighty stupid to lose its number one slot as "the preferred method to hold and spend purchasing power"


How to retrieve BCC mistakenly sent to BTC Electrum wallet? I sent my BCC from blockchain wallet to my BTC Electrum wallet and now I cannot trace them. Does not show in either of the wallets. How do i retrieve them?

Can you find the BCH on a block explorer website? What address are they currently in? Is it one that you control the BTC keys using electrum? If yes, then do the following:

You'll need to take the seed from your BTC Electrum wallet, and use it to generate a new BCH wallet using BCH software. Your BTC Electrum wallet will not show a BCH balance, since BCH is a different network (that uses the same addressing scheme).

It is a good idea to send ALL of the bitcoin out of your wallet, before you generate the BCH wallet using the seed. This is important, it ensures the keys that control your bitcoin remain safe. If the BCH software you use is malicious for some reason, it might check the BTC balance of the addresses you control, and steal the bitcoin from you.

Even if there is a small chance of this, you can be safe by just transferring all of your bitcoin out of electrum first, and then deal with the BCH.

Also, don't transfer the btc back to that wallet afterwards. You can still use electrum, you just have to make a new wallet with a seed that is different from the first one.


Fork and Longest Chain Rule At the same time, A and B succeed in resolving the "Proof of work" challenge and both add a new block to their local blockchain, then they propagate the new blockchains to other nodes. I have 2 questions:

1) If a node X receives first the blockchain from A, and it approves it, when it receives the blockchain from B, it simply reject it ?

2) If a node X receives first then blockchain from A, and then the B's blockchain in which also a node C has put another correct block (so is longer then A's blockchain), does the node X reject A's blockchain (applying the longest chain rule) and use the other blockchain as the correct one ?

2) Due to latency a miner node may not have the complete list of transactions, so it may start to build an incorrect block (for example some transaction misses). If the miner recognize is building an incorrect block (because for example, it received other transactions while it was building the block) it simply throws away the block and start building another one?

If a node X receives first the blockchain from A, and it approves it, when it receives the blockchain from B, it simply reject it ?

It will keep the block locally as an alternate chain, but not immediately discard it.

  If a node X receives first then blockchain from A, and then the B's blockchain in which also a node C has put another correct block (so is longer then A's blockchain), does the node X reject A's blockchain (applying the longest chain rule) and use the other blockchain as the correct one ?

Correct, once any one chain has accumulated more difficulty, the minor chain is discarded.

Note that here accumulated difficulty is a measure of how much hashpower was spent to produce the amount of work required for that chain. This is generally in sync with the chain being longer (a chain with more blocks will have more difficult in most cases), but it is not a guarantee.

  Due to latency a miner node may not have the complete list of transactions, so it may start to build an incorrect block (for example some transaction misses). If the miner recognize is building an incorrect block (because for example, it received other transactions while it was building the block) it simply throws away the block and start building another one?

This is really a separate question, but the answer is mostly "ASICs are fast, it doesn't matter". Miners are constantly producing update block templates with altered timestamps, secondary nonces in the coinbase transaction, and transaction lists. These are then passed to the actual machines doing the mining, which can burn through the nonce space in the header in a matter of seconds. A miner will simply wait for the old block template to be non-viable and create a new one with the better transactions.

Of course, if a miner does find a valid block on a slightly out of date template, they will broadcast that block - it makes no sense to give up a guaranteed 12.5 BTC for the possibility of slightly higher fees in a block you might not find before another miner.


Can bitcoins be exchanged by mailed check? I am wondering as I'm (obviously) a newbie to Bitcoins.  I'm not necessarily looking to do so, simply wondering how transactions can be made/what options there are for exchanges

Yes, this is theoretically possible, but in practice you will not do this, because an internet connection is necessary for preparing the payment on sender side and for verifying it on receiver side. Thus, if both parties have an internet connection anyways, it is likely that there is no reason for mailed information printed on paper.

However, if one would still want to do so, he can.

You can print the private key of a bitcoin address, which holds bitcoins, onto paper. For example you can print the data in hexadecimal representation or as a QR tag.
You can then later recover this bitcoin address from the printed information and use the bitcoins stored on it.

If someone wants to send bitcoins by mail, he would use this technique. He would first prepare a new bitcoin address, put the amount of bitcoin that he wants to pay onto this address, and print the private key.
Next, he would send the printed private key to the receiver.
The receiver would then take the information, import it into his bitcoin software, and finally, to make sure the sender does not anymore control the bitcoins, transfer all the bitcoins stored on this address to a new address, of which the sender does not have the private key.

The last step might seem unnecessary, because the receiver already controls the received bitcoins. However, the sender might also still have the private key and use it for transferring the sent bitcoins, thus emptying the address of which the receiver has the private key. To make sure, this can not happen anymore, the receiver moves the coins away from the possible access of the sender.

Another possibility is to put a physical coin into an envelope and send it. This is basically the same thing as above, becuase the physical coins are just another way of storing a private key of a bitcoin address, which holds some money. See https://www.casascius.com/ as an example for physical coins.


What is the difference between accounts and adresses? What is the difference between accounts and adresses? As discussed in this question accounts are a component of bitcoin wallets, different from addresses. What are they? How do they work?

A Wallet is a collection of Accounts and Addresses.

An Account is an arbitrary basket of Addresses. Transactions originating from and going into one Account will be kept separate from other Accounts (unless you use a move command, which moves the balances around without creating new transactions).

Address is the only part of this that is visible in the Block Chain.


Is it possible to watch the chain to count the number of Lightning channels? I know it's possible to get number of public Lightning channels from Lightning Network gossip and some implementations offer network graph and it can be queried. But it's not possible to see private non-routing channels there.
Can channel opening transactions be identified checking the blockchain? if not, what's the best way to estimate?
This is more of a theoretical query to understand the structure of messages used in lightning network channel opening bitcoin transactions.

They can only be detected when force closed and there are still pending htlcs otherwise they look like a spend from a 2-2 multisig wallet. I've been told some people try to do chain analysis and machine learning to predict private channels. I highly doubt that this is reasonably possible.

Although there is one thing to consider. If a node has public and private channels the funds get mixed. Implementations currently do not do separate bookkeeping of those outputs which is a privacy issue and an attack vector for what you want. However if a new ln node is set up and it only has private channels it will be hard to detect those on chain (unless the Chanel partners later reuses / mixes the outputs with some fire public channels.


Bitcoin vending machine If I wanted to build a vending machine where one could buy a cola paying with bitcoin, is the following scenario the typical way to do it?

Customer approaches the machine, and selects the product (whatever the method - button by the product image, or typing a corresponding numeric ID on a keypad)
Machine generates bitcoin address for this transaction and displays on a screen the address' QR code and alphanumeric representation, and the amount to be paid in bitcoins.
Customer uses their smartphone (or whatever device with bitcoin client) to scan the code, enters the amount and submits the transaction.
Vending machine waits for the expected amount to arrive in the account and

delivers the product if the amount is what was expected
sends the money back if the amount is not what was expected
timeouts if nothing arrives within 2 minutes
sends the money back if there were technical issues in delivering the product

To avoid necessity to store the private keys for every successful transaction, the vending machine sends the just collected amount to aggregation address and forgets the temporary address.

This sounds good, in broad strokes.  There are a couple of things I would watch out for:

Refunds can be tricky.  People who are using web wallets may not really have their own addresses; the wallet operator has a large pool of addresses and tracks customer balances internally.  When the customer wants to make a payment, the operator pays from one of the pool addresses and debits the customer's account.  So if you try to send a refund to such a customer, it goes back to the operator's address, but they may not have the ability / motivation to recredit the customer.  They might even throw away the private key once the coins are spent (and the change sent to a new pool address), in which case the refunded coins are lost forever.  Either way, the customer is bummed.  There is some further information at Is there a standard procedure for refunding Bitcoin transactions?, and BIP 70 is a proposed solution (where the customer provides a separate refund address explicitly), but since this involves some out-of-band messages over HTTPS, more infrastructure is needed on the server side.
You may want to give up on delivering the product after 2 minutes, but you might not want to give up on the payment.  For example, if either your machine or the customer's mobile device has Internet connectivity problems, the payment might be created but not broadcast (or not received by you) until much later.  The customer is probably no longer there to get their can of Tab, but you might want to refund their money anyway.  So you should keep the private key around.  (Actually, there's really no good reason to discard them: if you send the money back to HQ, they normally contain no coins so it's not really a problem if they are stolen, but if somebody sends extra coins to them for some reason, you'd sure like to have them.)
Similarly, if you do send a refund, you may want to make sure you spend the same transaction that came in.  This will protect you in case the customer tries to double-spend.
The payment amount can be embedded in the QR code.  This saves the customer a little typing.
Quickly sending incoming payments off to HQ for safekeeping is a good idea, but will cost you a fee on each transaction.  You could batch them and send them off a couple times a day, or whenever they reach some threshold amount.  Alternatively, you could have a system where you generate a bunch of addresses at HQ, keep the private keys there (perhaps even offline), and just give the machine the addresses.  (BIP 32 provides a fancier way to achieve that.)  The machine can still detect incoming payments, but if a refund is needed, it would have to send a request back to HQ.