Bitcoin Proof of work puzzle inconsistency At this time, I am really confused about the Proof of work puzzle because as I have seen in some documents, there are 2 different ways to talk about them.

The first one I have seen is from some videos, and also the original of Bitcoin by Nakamoto: the answers to the puzzle will make the result of hashing the block header contains some number of zeros from the start consecutively.

Meanwhile, there are also some documents saying that the result of hashing the block header has to be below a difficulty.

So I wonder which one I can trust now. Could anybody tell me? Thanks in advance :-)

The Proof of Work is not really a puzzle that is solved.

For a block to have a valid proof of work, the hash of the block header must be less than a given target. This will result in the hash having some number of leading 0's. People will then simplify that to be "some number of leading 0's" when explaining PoW to people. But it is actually less than a certain target value.

The target value is used to determine the difficulty (it's an inverse relationship: as the target decreases, the difficulty increases). If you were to calculate the difficulty of a block in the same way with its hash, then the difficulty of a block must be greater than or equal to the network difficulty.


How do mining-pools prevent work duplication? Do mining pools take any precautions to make sure that their members are not doing the exact same work (i.e. they've been given the exact same block to mine, and thus they're doing the same hash calculations as a fellow member)?

No, there's not a need. The "work" generated by the pool includes the time, transactions, transaction order, and a completely unique coinbase. All of this information is hashed once with SHA256 and then sent to the client for them to do the POW calculation on. There is absolutely no chance of two pools creating the same work, and indeed pool software is designed to make work unique to each user. Protocols like GBT and Stratum also generate work items locally so the pool server is even less involved.


BCC, BTC Private Keys If you were to send BTC accidentally to a BCC address then would the funds have been sent to the same private key on the BTC blockchain?  Would the owner of the BCC key be able to retrieve those coins in a BTC wallet?

Yes, BTC and BCC share the same addresses and the same private keys.


Viewing truly raw but decoded transaction data I've previously been using bitcoin-cli decoderawtransaction to get human readable bitcoin transaction data but am just learning that it's not only decoding the raw transaction but also adding extra derived fields (e.g. txid, hash) that aren't explicitly stated within the transaction held in the blockchain.

Purely as a means of education I want to be able to interact with exactly the transaction data that's stored by bitcoin in blocks/mempool with no extra extrapolated data.

What's the best way to get this data?


Does a wallet containing multiple addresses have a single private key? Title says it all. Would one private key enable you to recover all the addresses in your wallet? Or does a wallet just contain a series of key-pairs?

There are three main types of wallets:

non-deterministic (random) wallets
sequential deterministic wallets
hierarchical deterministic wallets

With a non-deterministic (random) wallet, all the private/public keypairs are generated randomly. The wallet may generate 100 random private keys as soon as it is initialized, for example.

With a sequential deterministic wallet, a passphrase or sequence of characters is randomly generated to act as a seed. It is then repeatedly incremented and hashed to generate new private keys.

With a hierarchical deterministic wallet, a single keypair is created initially and is known as the master keypair. This master keypair is used to generate child keypairs (remarkably, new bitcoin addresses can be generated using just the public key).

Here's a more in-depth explanation: What is a deterministic wallet?

Also, here's my python implementation of a sequential deterministic wallet. And here's a good example of a hierarchical deterministic wallet.


Rise difficulty in code, still no changes after rebuild I'm playing around with the code and tried to adjust difficulty by changing code from

  bnProofOfWorkLimit = ~uint256(0) >> 1

to

bnProofOfWorkLimit = ~uint256(0) >> 20

inside code block for Regression Test in chainparams.cpp (bitcoin-0.10.0).

I configured, did make, then make install with binaries in a custom directory (not default /usr/local/bin/bitcoind !), started bitcoind in regtest mode and generated some blocks.
Somehow it feels like it takes same amount of time for generating blocks as before modifying the code.

What am I doing wrong?

UPDATE:

Changed difficulty in chainparams.cpp from

  bnProofOfWorkLimit = ~uint256(0) >> 1

to

bnProofOfWorkLimit = ~uint256(0) >> 32

still getting this:

Bitcoin version v0.10.0.0-g047a898 (Fri, 13 Feb 2015 09:55:11 +0100)
Using OpenSSL version OpenSSL 1.0.1f 6 Jan 2014
Using BerkeleyDB version Berkeley DB 4.8.30: (April  9, 2010)
Default data directory /home/aliakbar/.bitcoin
Using data directory /home/aliakbar/Downloads/bitcoin-0.10.0_test1/build/bin/test1/regtest
Using config file /home/aliakbar/Downloads/bitcoin-0.10.0_test1/build/bin/test1/bitcoin.conf
Using at most 125 connections (1024 file descriptors available)
Using 4 threads for script verification
Binding RPC on address ::1 port 23333 (IPv4+IPv6 bind any: 0)
Binding RPC on address 127.0.0.1 port 23333 (IPv4+IPv6 bind any: 0)
Using wallet wallet.dat
init message: Verifying wallet...
CDBEnv::Open : LogDir=/home/aliakbar/Downloads/bitcoin-0.10.0_test1/build/bin/test1/regtest/database ErrorFile=/home/aliakbar/Downloads/bitcoin-0.10.0_test1/build/bin/test1/regtest/db.log
Bound to [::]:13333
Bound to 0.0.0.0:13333
init message: Loading block index...
Opening LevelDB in /home/aliakbar/Downloads/bitcoin-0.10.0_test1/build/bin/test1/regtest/blocks/index
Opened LevelDB successfully
Opening LevelDB in /home/aliakbar/Downloads/bitcoin-0.10.0_test1/build/bin/test1/regtest/chainstate
Opened LevelDB successfully
LoadBlockIndexDB: last block file = 0
LoadBlockIndexDB: last block file info: CBlockFileInfo(blocks=0, size=0, heights=0...0, time=1970-01-01...1970-01-01)
Checking all blk files are present...
LoadBlockIndexDB(): transaction index disabled
Initializing databases...
Pre-allocating up to position 0x1000000 in blk00000.dat
ERROR: CheckProofOfWork() : nBits below minimum work
ERROR: CheckBlockHeader() : proof of work failed
InvalidChainFound: invalid block=0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206  height=0  log2_work=1  date=2011-02-02 23:16:42

What am I doing wrong? Do I have to adjust difficulty somewhere else than in chainparams.cpp?

What am I doing wrong?

Not setting the difficulty high enough. A standard computer can do 1 MH/s SHA256d hashes, or about 2^20 hashes. That means in your scenario, solving a regtest block will take about 1 second. If you want it to take longer, increase the difficulty.

Also, note that if you're using an 0.9.* version of bitcoin, then setting the regtest difficulty to below ~uint256(0) >> 16 won't really do much, as the mining code won't even check a result that doesn't hash to below that difficulty.

If you're using the most recent code, though, then rather than adjusting the regtest parameters, you could also just add your own set of parameters.


Restore Seed with Password I am running Electrum 2.3.2. I had 2-factor authentication enabled with Google Authenticator, but then got a new phone. I know the password to the wallet but do not have the 2-factor code anymore. I do not know my seed. Is there a way for me to get access to my coins in this situation?

When looking at the wallet file I do not see a key entry in the text.

Unfortunately I am only seeing how people do this when they have the seed but not the password, which is the opposite of my situation.

The 2FA wallet means there are two distinct sets of private keys, one you hold in your wallet, and one held by a third party. Normally you are authorizing the third party to sign transactions with their private keys on your behalf by giving them a valid 2FA code. In the case of Electrum, the third party is a company named TrustedCoin.

Their terms of service explicitly state that there is no recovery service for lost 2FA tokens.

3. Integration with 3rd-Party Wallets

If you forget your one-time password generator, we offer no way to recreate it.  You will need to use your second key to move your funds to a new address.

From the information presented you will need to find your Electrum seed to restore both halves of your wallet, or find a backup of your phone that contains the 2FA token files. iOS for example will  back these up into iTunes, it is likely that Android devices have similar backups that will contain them as well.


upgrading to bitcoin 0.10.2 fails i am attempting to upgrade my bitcoin client on debian wheezy. i have been following the docs for this version and i installed berkley db to ${BITCOIN_ROOT}/db4 as directed. that went fine, but now when i run ./configure it says the wrong version of berkleydb is installed:

checking whether C++ compiler accepts -fvisibility=hidden... yes
checking for Berkeley DB C++ headers... default
configure: error: Found Berkeley DB other than 4.8, required for portable wallets (--with-incompatible-bdb to ignore or --disable-wallet to disable wallet functionality)

i also found that autogen.sh does not exist in the bitcoin root dir so i was unable to run it as per the instructions.

i already have berkley db 5 installed:

$ dpkg -l | grep db5
ii  db5.1-util                                   5.1.29-5                           amd64        Berkeley v5.1 Database Utilities
ii  libdb5.1:amd64                               5.1.29-5                           amd64        Berkeley v5.1 Database Libraries [runtime]
ii  libdb5.1++:amd64                             5.1.29-5                           amd64        Berkeley v5.1 Database Libraries for C++ [runtime]
ii  libdb5.1++-dev                               5.1.29-5                           amd64        Berkeley v5.1 Database Libraries for C++ [development]
ii  libdb5.1-dev                                 5.1.29-5                           amd64        Berkeley v5.1 Database Libraries [development]
ii  libdb5.1-java                                5.1.29-5                           all          Berkeley v5.1 Database Libraries for Java
ii  libdb5.1-java-jni:amd64                      5.1.29-5                           amd64        Berkeley v5.1 Database Libraries for Java
ii  libkdb5-6:amd64                              1.10.1+dfsg-5+deb7u2               amd64        MIT Kerberos runtime libraries - Kerberos database
ii  libsybdb5:amd64                              0.91-2+deb7u1                      amd64        libraries for connecting to MS SQL and Sybase SQL servers

i don't want to remove db5 because other programs i rely on are using it:

 $ apt-cache rdepends db5.1-util
db5.1-util
Reverse Depends:
  subversion
    db5.1-util:i386
  subversion
    db5.1-util:i386
  libapache2-svn
    db5.1-util:i386

how can i get bitcoin to install with berkley db 4.8 when 5.1 is already installed elsewhere?

To allow compatibility of your wallet.dat file with other bitcoind installations, it's strongly recommended to use bdb 4.8.

Nevertheless, you can disable the db4.8 check by adding --with-incompatible-bdb during configure.

Better would be to manually install berkley db 4.8 in a isolated path and compile bitcoin-core with something similar to:

CPPFLAGS="$CPPFLAGS -I<your-bdb4.8-path>/include"
LIBS="$LIBS -L<your-bdb4.8-path>/lib"

But this would probably require some makefile tweaking.


How can I make transaction output time locked? Is it possible to submit some coins to some address and make them spendable after some period of time?

Like I want submit 1btc to address 1Kc24m... and make that output to be spendable after january 1st 2030.

Yes, you can use OP_CHECKLOCKTIMEVERIFY opcode in the locking script of the output. This opcode takes either blocks or Unix Epoch Time (seconds since 1-Jan-1970) as the parameter to lock. If the parameter is non-zero and below 500 million, it is interpreted as a block height, if it is greater than or equal to 500 million, it is interpreted as a Unix Epoch timestamp. When you would reference this UTXO at the time of spending, you need to set the transaction nLocktime equal to or great than the OP_CHECKLOCKTIMEVERIFY. The nLocktime parameter while spending should be same as what was specified in the CLTV; i.e. if the CLTV locking parameter was in blocks, it should be specified in blocks, otherwise in Unix Epoch timestamp.

Since you want it to be spendable after 1st Jan 2030, that is equivalent to timestamp of 1,893,456,000 (or 0x70dbd880). So your locking script will be concatenation of:

OP_DATA (size of CLTV_expiry): 0x04
CLTV (little endian): 0x80d8db70
OP_CLTV: 0xb1
OP_DROP: 0x75
OP_DUP: 0x76
OP_HASH160: 0xa9
OP_DATA (size of address): 0x14
Address: <address>
OP_EQUALVERIFY: 0x88
OP_CHECKSIG: 0xac

Two things to note: (1) When you are spending this transaction, the input referencing this UTXO needs to have nSequence value between 0xF0000000 to 0xFFFFFFFE. (2) Median_time (time of last 11 blocks) is used to check nLocktime when the script is evaluated which is generally about hour behind the actual time on your wall clock.


Is it feasible to use the Blockchain technology without the Bitcoin? Every once and a while, I step into some article like this one: Forget Bitcoin -- What Is the Blockchain and Why Should You Care?.

I've been hearing a lot of blabbering about companies to begin using the Blockchain technology for book keeping, for example, but making no use of Bitcoin at all.

I wonder: how is it possible to separate both things?

I mean, the aim of Satoshi Nakamoto was to create a decentralized coin that would supress the need of a trustworthy third part, which operates over the Blockchain.

The main aspect of the Blockchain is that it's a decentralized network, working on a peer-to-peer basis, no servers, no clients, only peers. The only reason someone would contribute to the building of the Blockchain is the monetary reward in form of mined bitcoins.

How could a company make use of the Blockchain? How would it pay someone to do its book keeping (or whatever) without payments in crypto-currency?

I see that this might be a rather wide question, but I'd be satisfied with only one example of how could it be possible to use the Blockchain technology without Bitcoin (or similar crypto-currencies).

Blockchain by definition is a data structure, in that sense we can and already have decoupled it from Bitcoin.  There are many alt-currencies that implement blockchain as a data structure and a data store.

Ethereum is building a blockchain based application platform.

Storj is an example of blockchain technology that also is trying to create a blockchain for data storage.

The SAFE(Secure Access For Everyone) network is attempting to build an entire computing platform built on a blockchain.

The key is incentivizing some form of participation by providing a service. On the Bitcoin blockchain the service being provided is the ability to send value globally very quickly.  Thus the reward that was created is financial.


Find Lightning node for channel creation based on amount and route Is there a tool to identify a Lightning node that will accept a channel open request and that matches the two conditions below?

Accepts channel amounts of less than or equal to X.
Can route payments, directly or indirectly, to node N.

The scenario is I want to send a small payment to node N but it only accepts new channel requests with amounts much large than X.
My only solution at the moment is to use an explorer to find all the nodes N has channels with and then try creating a channel with each of them for X.

The mentioned lightning explorers show information from the gossip protocol which nodes usually have copied locally and provide to users. In clightning you can for example access that information with lightning-cli listchannels If I remember correctly  in lnd the command is lncli describegraph.
Gossip says a few meta data about what channels nodes accept. however in general a node cannot / will not guarantee that you will be able to route a payment of a particular size to node n (though in practisce it will most likely work)


What sort of tasks can an ASIC be developed to do? I know requiring a lot of memory is one thing that makes an algorithm ASIC resist. Are there any others?

Could an ASIC be developed to do Elliptic Curve Crypto? Like adding two points, or signing a piece of data? Could an ASIC be developed to solve polynomial equations?

Taken from ASICs and Decentralization FAQ by Andrew Poelstra:

Are ASIC’s evil?
No, dedicated hardware brings us closer to the thermodynamic limit,
and is therefore eventu- ally a good thing for mining
decentralization. Also, because ASIC’s produce more hashes for the
same amount of energy, they produce stronger proofs-of-work with
proportionally less environmental impact.
However, ASIC’s bring with them a risk of manufacturer centralization,
such as what we saw with Bitcoin in the early days of ASIC mining.
Market forces eventually broke this monopoly and one thing which sped
up the process is that Bitcoin uses the SHA2 hasing algorithm, which
was designed for easy development of dedicated hardware.
Therefore, relatively little startup capital is needed to develop
Bitcoin ASIC’s. Further, regardless of one’s personal feeling toward
ASIC’s, they are inevitable. Dedicated hardware will always be more
efficient than general-purpose hardware (exactly because it is closer
to the thermodynamic limit) and Bitcoin’s incentives are aligned for
ever-increasing efficiency.
Is ASIC resistance desirable?
No. ASIC resistance typically involves increasing algorithmic
complexity to discourage ASIC developers. However, ASIC’s are still
inevitable; all ASIC resistance does is increase the startup capital
required and therefore increase centralization of manufacturing.
Further, increasing the complexity of proof generation often means
also increasing the com- plexity of proof validation, often
disproportionately slow. This discourages (unpaid) non- mining
validators, which also increases centralization.
Is ASIC resistance possible?
ASIC resistance, in the sense of making life difficult for ASIC
manufacturers (and therefore reducing the number of distinct
manufacturers) is possible. But it is impossible to create an
algorithm which runs at the same speed on general-purpose and
dedicated hardware (since general-purpose hardware contains many
extraneous features, e.g. communication buses for peripherals), and so
ultimately ASIC resistance is futile.
(Schemes such as “the developers will just change the proof-of-work
algorithm if ASIC’s appear” do not even make sense — in a
decentralized currency the developers have no such power, while in a
centralized currency proof-of-work is a completely unnecessary waste
of power.)
Is memory hardness desirable?
No. Memory hardness has the effect of increasing ASIC board footprint,
weakening the heat- dissipation decentralization provided by the
thermodynamic limit. Further, it increases the capital costs of mining
equipment relative to the energy costs, which also encourages cen-
tralization (since established miners have amortized their equipment
more than new miners). These effects are amplified by the fact that
SRAM is both several times faster and several times more expensive
than DRAM.
Also, memory hard proofs-of-work often require lots of memory on the
part of the verifiers which is bad for decentralization as already
discussed.
As an aside, since memory is far away and expensive to access on
general purpose computers, memory hardness actually increases the
benefit provided by ASIC’s! This is contrary to the goals of most
memory-hard advocates, and as we have seen above, memory-hardness
worsens the centralizing effects of ASIC’s while weakening the
decentralizing effects.
One more thing worth mentioning is time-memory tradeoff (TMTO). This
is a property of an algorithm which allows higher memory usage to be
traded for a heavier computational load. An algorithm which is highly
susceptible to TMTO has poorly defined memory hardness, which at the
very least complicates analysis. It may also cause an algorithm to
fail to be optimization free.


Where to find a list of Bitcoin attorneys? Does anyone know where to find a list of attorneys well-versed in Bitcoin?  A standard Google search has yielded decent results, but just wondering if this already exists somewhere.

More specifically, does anyone know of attorneys in the Chicago area that work in the Bitcoin related areas.

Depending on the magnitude and urgency of your question, you might want to try contacting the Bitcoin Foundation:

Coindesk reported in July that the Foundation formed a Legal Defense Committee of which Brian Klein is the chairman. Either his office, or the Bitcoin Foundation's General Counsel Patrick Murck's office should be able to answer legal questions or refer you to someone.


What are the "Know Your Customer" challenges that Bitcoin faces? Can anyone explain what KYC (Know Your Customer) regulations are "missing", tough or impossible to implement with Bitcoin?

I will offer a bounty to the most detailed answer
(However this question is too new for me to do so)

TL;DR

Businesses in the Bitcoin space face no special challenges to implement KYC regulation, except the privacy oriented mindset special to some bitcoin users. However, it is impractical to enforce KYC regulation on the entirety of the bitcoin network itself.

Long version below

Know Your Customer (KYC) regulation applies to financial institutions and other regulated companies such as for example money transmitters and currency exchanges. It's stated goal is to make such companies report potential money laundering and to protect against identity theft.

The core component of KYC forms around following a Customer Identification Program, which means that the above introduced institutions have to form a reasonable belief that they know the true identity of each customer. This means that in order to comply with regulation they will require their customers to validate their accounts. The companies don't face any special difficulties whatsoever, except that there might be a slightly bigger number of Bitcoin users that will be adverse to their services due to KYC requirements.

On the other hand, companies that offer comparable money transmission services as the bitcoin network itself would be required to implement KYC regulation. It is possible that at some point in the future a country might require by law Bitcoin users to disclose their bitcoin addresses. However, that would be impractical – if not impossible – to enforce, as, due to the decentralized nature of the Bitcoin network there is no central entity that could be forced to disclose such information about other users and there would be any number of participants that would have to be monitored and brought into compliance in order to collect such address information about their business partners. Additionally, even if associated to certain addresses through business partners informing on them, in most cases users would be able to plausible deny control over said addresses.


Security of Bitcoind Due to recent reports of theft activities by hackers, is cyber security is an on-going concern for Bitcoin and are active measures being taken to improve security?

You should always be aware of scam/hacks/thefts. Millions of dollars is stolen from 'regular' netbanks every year, so this is not really a "bitcoin-only" problem.

Bitcoin is based on crypto, so use this to protect your wallet. You can secure bitcoins way better than any other currency, but if your storing large amount of bitcoins in a unencryptet 'hot' wallet on a unsecure server, then your begging some hackers to steal your bitcoins.

You can find a lot of tips about securing your wallet here: https://en.bitcoin.it/wiki/Securing_your_wallet

But heres also some simple tips:

Encrypt your wallet (the build-in encryption is (almost) unbreakable as long as you choose a strong passphrases)
Never store all your bitcoins in a 'hot wallet' (unless your going to spend them all at once)
Make sure to take backups, and store them securely offline! (bitcoin-qt has a build-in key pool).
And make sure to keep your computer clean for malware


What is the maximum number of inputs/outputs a transaction can have? Is there a maximum recommended number of inputs/outputs for each transaction? I was scripting a faucet and wasn't sure whether to payout in one transaction to all addresses or split them into groups of say 100 or 1000.

The total size of the transaction must be less than 100,000 bytes or it will not be relayed across the network or included in blocks.

There COULD be a miner that is mining >100K transactions, but I don't think there is; if there is such a miner or you mine the transaction yourself then the limit would be the 1,000,000 byte blocksize limit.


Cryptocurrency with small block size limit or large block time So there are a lot of cryptocurrencies that tries to improve on Bitcoin's  1 Mb block size limit and 10 minute block time (6MB per hour) by using faster block times or larger block size limits. For example litecoin has 1 Mb block size limit and block time is 2.5 minutes (24MB per hour). Dogecoin has 500kb block size limit and block time is 1 minutes (30 MB per hour).

Is there any cryptocurrency that does the opposite and uses either a longer block time or a smaller block size, with the intention of limiting blockchain growth?

I am not aware of any cryptocurrency that has block times of greater than 10 minutes, but I am very familiar with the desire to limit growth of the block chain.

Monero recently increased its block time from 1 to 2 minutes in part for the reason you mentioned (but also in part to reduce the # of orphan blocks which occur more frequently when block times are very short)

Monero uses an adaptive blocksize that automatically scales based on blockchain usage.

https://www.reddit.com/r/Monero/comments/45b8qn/my_journey_to_finding_monero_and_some_questions/czwlcdb

A quadratic penalty is imposed such that block subsidy = base subsidy * ((block size / median size of last 400 blocks) - 1)², with the penalty being applied after you build a block larger than the median size. The maximum block size is 2*median size. Because subsidy is based around the number of coins in existence, the 'burned' subsidy is deferred to be paid out to future blocks.


Corrupted transaction In this transaction There's a decoding error and an escrow. What could cause this?

The decoding error is not really an error, per se, just an OP_RETURN. OP_RETURN is used for storing data in the blockchain and that's what this transaction is doing. It's not actually a spendable output, so the block explorer is getting confused and puts out a decoding error.


Selecting a computer for the OFFLINE Electrum Wallet Would a Samsung Chromebook be a suitable choice to run the offline wallet???
I read that Chromebooks run a Unix based OS.
(I would obviously disable networking, bluetooth etc.)

Thanks

It seems possible but a bit of a hassle to install python (required for Electrum).

According to this
question
you can enable Developer Mode to get a shell.

Alternatively there seems to be a Chrome plugin to get a shell.

Thus, if you already have the Chromebook it is a viable choice. Otherwise I would suggest a cheap system which allows more freedom out of the box.


Bitnodes for node on testnet I have used the bitnode's own script to install a full node on an Ubuntu 16.04 Digitalocean droplet. I can verify that my node is up and running by checking the IP with port 8333 on Bitnode's check node. However I need a testnet node so I next added the following line to the config file:

testnet=1

It seems the above line produces the desired effect of turning the node into a testnet node and this can be verified through bitcoin-cli commands. But the node will no longer be accessible from Bitnode. Is Bitnode designed to only work with nodes on the main blockchain or am I missing a necessary step?

testnet is usually running on port 18333. did you check that port?


Pre-requisites for calling Getwork I'm a novice to bitcoin trying to learn mining. I know that in order to get the value (header) to hash, you call Getwork. I have seen the bitcoin wiki page for it and read some relevant threads on different forums. What I want want to know is what is required before one can make a call to Getwork? Specifically the following:

What URL to call with what parameters?
I understand it is a REST call. Can you confirm this is so?
Do you need to be registered before being able to make the call?

Please post any relevant links that might help.

Most miners now use Stratum, but the old getwork protocol isn't completely gone yet.

The URL is the root path (/) of the server usually at port 8332, for instance http://mint.bitminter.com:8332. You can see what the data looks like here: How can I code a Bitcoin JSON-RPC "getwork" request in Java?
No, this is JSON-RPC. It's an RPC-style interface, which is more or less the opposite philosophy to REST. It's not even a good RPC design as the same procedure "getwork" is used both for getting work and for returning work results.
HTTP Basic Auth is used for authentication. If you are talking to bitcoind you put the user name and password in the config file. If you are talking to a pool you register at the pool.

There is some info about getwork and its various extensions at https://en.bitcoin.it/wiki/Getwork


So, it's looks fine, right?

No. It does not look fine. You have to put your 'secret' into scriptSig. And your scriptPubkey should be redeem to one of your addresses (for example to msimoNvz23QXyiRofLtGSCsVdkdsNJn4SU). You should not try to sign this transaction - redeeming it does not require ecdsa signature

something like this:
(sorry, I did it "by hands", so it may be incorrect)

01000000
01
13a8a4171e5394b98ad10115a24c6b12cd33265b75cb77db724081e681c9526b
00000000

86    // length of script
4c84  // push 0x84 following bytes
6164666c61647366687569666f38727938666834753465743465357473673431356574343538733433657467343173333565346733353431723335673134337367353473333835673431733533356531673433357334673b2e3a3b2c5b40736e726c74676e6a736c656e6a72676b6c736e6c6569676e696c736e6b6c676e736c6e676c6b
ffffffff

01                 // one output
204e000000000000   // value in hex
19                 // length
76 A9 14 85ddbd9c2f9733dc3860b9e1ffcdc0da2633004b 88 AC // redeem to msimoNvz23QXyiRofLtGSCsVdkdsNJn4SU

00000000


Alert Key Compromised, upgrade required I just got this message: "Alert key compromised, upgrade required".
 How urgent is this? Am I in danger of losing my Bitcoin?
 What do I do?

The network wide Alert system is being retired. No Bitcoins are at risk and this warning may be safely ignored. Upgrade to the newest version of your wallet software to no longer see the alert.

Read more here.


Vanity Mining Error? Well after getting a new graphics card (7770) I can mine bitcoins at around 120 - 180 Mhash/s Depending if I run it at full power or not.

Now I thought I would try and mine myself an address using it but the miner just seems to not work.

Using Vanitygen (Linked below) oclvanitygen I set it off mining with reports of it mining at around 4MKeys/s but nothing was showing up after 5 mins worth of time(I tried a simple prefix of 1r).

I then tried using just vanitygen64 and in seconds it found an address.

Does anyone know why?

https://bitcointalk.org/index.php?topic=25804.0

All you need to do is to add two lines to oclengine.c:

vg_ocl_device_getstr(vocp->voc_ocldid,
                           CL_DEVICE_NAME);
                           CL_DEVICE_NAME);
+           if (!strcmp(dvn, "Tahiti") || !strcmp(dvn, "Barts") || !strcmp(dvn, "Pitcairn"))
+               quirks &= ~VG_OCL_AMD_BFI_INT;
            if (!strcmp(dvn, "ATI RV710")) {
            if (!strcmp(dvn, "ATI RV710")) {
                quirks &= ~VG_OCL_OPTIMIZATIONS;
                quirks &= ~VG_OCL_OPTIMIZATIONS;
                quirks |= VG_OCL_NO_BINARIES;
                quirks |= VG_OCL_NO_BINARIES;

Add the lines starting with +, but don't copy the plus sign.

This code adds optimizations for AMD HD 68XX, 69XX, 7XXX

Thanks to Kevin Pan for his patch!


What are the perceived advantages of bitcoin as a means of exchange? There are lots of ways to send money - western union, paypal, bank wire, etc that are more established and fairly quick. What are the advantages of using bitcoin from a bitcoin-proponent's point of view?

The primary advantages are:

Speed and price. You can transfer money anywhere in the world within minutes with negligible fees.
No central authority. Bitcoin is not dependent on any company or government to maintain its value.
You can start accepting bitcoins instantaneously, without setting up merchant accounts, buying credit card processing hardware, etc.
Bitcoins are less traceable than many types of monetary transactions (though not anonymous).
Bitcoins cannot be counterfeited and transactions cannot be reversed.
No transaction blocking or account freezing. We have seen governments freeze bank accounts of dissidents and payment processors refuse to process certain types of transactions (wikileaks, online gambling in the US, etc). With bitcoin this is impossible.
A known amount of inflation. Bitcoin is seen as a store of value because the total number of bitcoins that will ever be created is known in advance and it is impossible to create more than that.


Why does using a wallet in cold storage make it less secure? According to How to set up a secure offline savings wallet,

  Every time you retrieve bitcoins from your savings wallet, create a fresh savings wallet by repeating the above procedure, and send all your remaining savings balance there.

Why do you need to create a fresh wallet after retrieving a few bitcoins?

Is the receiving address no longer valid?

How can you create a secure offline wallet, send bitcoins to it, and then test it to make sure that it works by sending a small amount out?

I believe the basis of this recommendation is clients' tendency to create invisible change addresses. A transaction sending the entire balance to a known address eliminates the possibility that a part of the balance could be lost when a private key for a change address is not retained.


libbtc: Where are the binaries generated? I installed and compiled libbtc from https://github.com/libbtc/libbtc, but where are the binaries generated or how can I compile my C project with gcc using it?
My OS is Ubuntu 20.04.
I am running:

./autogen.sh
./configure
make
sudo make install
sudo make check

But when I run make check, it never ends.
EDIT: make check resulted ./build-aux/test-driver, linha 107: 18325 Segmentation fault (core dumped) "$@" > $log_file 2>&1
FAIL: tests
============================================================================
Testsuite summary for libbtc 0.1
============================================================================
# TOTAL: 1
# PASS:  0
# SKIP:  0
# XFAIL: 0
# FAIL:  1
# XPASS: 0
# ERROR: 0
============================================================================
See ./test-suite.log
Please report to https://github.com/jonasschnelli/libbtc/issues
============================================================================

How the console tells, maybe this is not the correct place, also because you receive a segmentation fault (core dumped) during the make check.

See ./test-suite.log
Please report to https://github.com/jonasschnelli/libbtc/issues

However, may you have installed the library in your system with the command sudo make install, this command puts the binaries of the library is a place where are all the libraries of the system?
Maybe you have only a failure in the check
But the last commit of this library is on Nov 4, 2018, and maybe this can be a signal of the motivation of your error.
I hope I clarify your idea


Securing web app wallet.dat (Ubuntu) I'm building a web app making JSON-RPC calls to the bitcoind server. I have security concerns on how to protect the wallet.dat file.

I'm encrypting the directory where wallet.dat will be.
Should I also use the bitcoind encryptwallet command?
When using Bitcoin client wallets like Electrum every time I send BTC it asks me for my password. Building a web app where users will have their own account (and addresses) should a bitcoind password be used? Does bitcoind store the private keys for every public address generated?

Thanks

Yes for all your questions.

Suppose you don't encrypt wallet, if someone access your computer with unlocked bitcoin directory (such directory must be readable for running bitcoin) he can steal your BTC.

It might be better just to encrypt wallet and leave unencrypted directory. He can steal encrypted wallet.dat, which isn't useful.


Could something like proof of work be provided in the form of human creativity voted on by other humans? All that's necessary for a proof system in a blockchain, as far as I know, is that mining be hard to do and easy to validate. Creating works of art is hard to do, but determining their value is relatively easy. The only issue I, who knows very little about blockchains, can find with this is that it would be quite slow. What are some issues that might come up with this, and is it generally plausible?

These are not the only requirements.

The most fundamental requirement is that the PoW actually verifies something. It's not enough to do work and prove that you've done it - the work actually has to express acceptance of a specific branch of the block tree. Otherwise, it's useless in preventing double spending.

It follows that the problem to be solved must be generated from the details of a specific branch/block, and the proof must show that work was done with this specific block in mind. The work cannot be reused to signal acceptance of a different block. The block is baked into the work in the most fundamental level.

How would you do that for creative work? How do you generate creative assignments that are tied exclusively to some specific block? That's completely far-fetched. If the work is, say, a painting - once the work is done and the painting is drawn, it can just as easily be assigned to block A as it can to block B. It therefore verifies nothing.

Another requirement is that the work is not only verified easily, but also in a digital and decentralized way. Your software can, without any additional knowledge, computationally verify that some amount of hashing was put into a block. It cannot verify that someone who voted is indeed a human - it needs to rely on external trusted sources for that.

Which leads to the final point, which virtually everyone who proposes alternative PoW mechanisms miss - if there was a way to verify the identity of humans and collect their votes, there would not be a need to have proof of work at all. Instead of voting on works of art, they can just vote on which branch they think is right. This way they can synchronize transactions and prevent double spending. The whole reason we don't do that in Bitcoin, is that there is no way to verify identities in a decentralized, digital way, with the standards sufficient to reliably administer the voting. This is why we rely on independently verifiable proof of computational work.


bfgminer using 100% CPU I noticed that bfgminer is using 100% CPU on my Linux system even though it's using a Block Erupter ASIC.  Why is it using so much CPU? Is it possible to prevent that?

When using the [M] option in the console window and then using [+] to add devices you can type in "all" and this should select the ASIC USB Block Erupters and not the CPU. I had the same issue when I typed in "auto" which directs bfgminer to start looking for devices on your system to use for mining. Try doing [M] then [+] and typing "all" and then [Enter]


What is the order of block hashes in block-locator array? I have to compose a "getblocks" command found in https://en.bitcoin.it/wiki/Protocol_specification#getblocks

The "getblocks" command contains the "block locator hashes". In essence, I inform a remote node of block hashes that I'm aware of already. There is a rule of how to construct the block locator. Except I’ve no idea of what “pushing”, “going back” or “newest back” means. I cannot figure out the order of block hashes in what I call a locatorArray.

Let’s assume I want to advertise three block hashes:

Block hash of block number zero.
Block hash of block number one.
Block hash of block number two.

Let’s assume I have an array of three elements. For example, I might walk through the array in a for loop as follows:

for ( int i = 0; i < locatorArrayLength; i++ )
{

}

The block hash of which block number should be in locatorArray[0]?
The block hash of which block number should be in locatorArray[2]?

The code on that wiki page is how Bitcoin Core constructs block locators, and it's a good method, but the method isn't enforced by the protocol. All you need to do is list a bunch of block hashes that you know about, ordered by descending block height. So in your example your locator could be (2,1,0), (2,1), (1), etc., but not (1, 2).


Limits on lightning channels and payments What are the upper and lower limits on Bitcoin Lightning channel balances and transactions, and where are these limits defined?

Stuff like this can usually be found in the lightning-rfc aka BOLT (basics of lightning technologies) which is the formal protocol specification.

Currently channel capacity can't succeed 1/6 of a Bitcoin. However for BOLT1.1 (the next version of the protocol) it was agreed that this limit should be dropped (if both nodes of a channel agree to do so). Single payments should be less than 0.04 BTC. I don't remember if this is also supposed to be changed or even part of the Bolts or if it is just a self imposed limit by the implementations.

Balances can be up to the channel capacity. They are encoded in the commitment transactions which spend the funding transactions. So this part is defined by the bitcoin consensus rules.


List of all currencies which can be mined by a SHA256-based ASIC miner Lot of information over this scattered over the internet, but can someone list complete list of currencies that can be mined by an AntMiner U2 apart from bitcoin, or any other SHA256-based miner?

You should try to touch this
https://coinmarketcap.com/currencies/views/all/
Need to filter out those which aren't sha256d though.


Ripple Data API vs Ripple RPC I need to write a program that monitors the transactions that sent to me.
My approach is to periodically (like every 2 minutes) call the Ripple public api to get transactions for my account.  But on the developer doc, I find two way to achieve this:

Ripple Data API .
example:

  https://data.ripple.com/v2/accounts/rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn/transactions?type=Payment&result=tesSUCCESS&limit=3

WebSocket/Json-RPC API. send to s2.ripple.com:443
with websocket or http.  example:

  {   "id": 1,   "command": "account_tx",
  "account":
  "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
  "ledger_index_min": -1,
  "ledger_index_max": -1,
  "binary": false,   "count": false,
  "limit": 10,   "forward": false }

I didn't check carefully, but they seem to have same response(with different format).

My question is :

are they equivalent?
which one should be preferred or which one is recommended by ripple?

You can use both solutions. Api is based on Json-RPC. Its app for getting transactions on address. You can change it for your needs.

const RippleAPI = require('ripple-lib').RippleAPI;
var test_server = 'wss://s2.ripple.com';
const api = new RippleAPI({
    server: test_server // Public rippled server
});
api.connect().then(() => {
    /* begin custom code ------------------------------------ */
    const myAddress = 'rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn';
    console.log('getting account info for', myAddress);
    return api.getTransactions(myAddress);
}).then(info => {
    console.log(info);
    /* end custom code -------------------------------------- */
}).then(() => {
    return api.disconnect();
}).then(() => {
    console.log('done and disconnected.');
}).catch(console.error);

Good luck)


I invested in bitcoin mining. Is this legit? I invested 250.00 I was told by a miner I could make 3200.00 in profit . Once my profits were shown on blockchain, it read non spendable. I asked what it meant and he said I'd have to invest 500.00 more to qualify for the minimum withdraw. Is this legit?

Is this legit?

No, it's a scam. You gave money to a thief, don't give them any more.

Communicating to the thief is a waste of time, they are a confidence trickster who exploited your weaknesses once to trick you into giving them money. Don't let them trick you again. You have nothing to gain by communicating with them.

You will never get anything back, there is no way to undo this and get your money back. You can and should report this to the police but the scammer probably lives in a far-away country and the police will not be able to do anything for a 250 loss (even if that's BTC not USD or INR).

See Mining Scams

  my profits were shown on blockchain

I guess you mean in a wallet managed by Blockchain Luxembourg S.A.R.L (LU) - a European business who run www.blockchain.com, www.blockchain.info etc. They are certainly innocent in this (though you could argue, to the government of Luxembourg, in which I guess you have no representation, that this business has a duty of care to its customers or to victims of its customers).

If the thief created this wallet or you created it and gave the thief the password, it is almost certainly a useless watch-only wallet. The thief can move money into it to make it look like you earned profits but those are illusory and not real. Changing passwords does not make the wallet safe, it does not lock-out the thief - they retain control over any Bitcoins sent to that wallet in past present or future.  It would be prudent to not touch that wallet ever again.


Sending funds via routing number from bank Is it possible to send funds from a bitcoin account via routing number to a trading account?

Not without an intermediary. Banks deal with traditional currencies like Euros or US Dollars, whereas Bitcoin is completely based on transactions involving bitcoins.

The only reason bitcoins have a value denominated in USD or Euros is that there are people willing to buy them for that value. Other than that bitcoins and traditional currencies are completely detached from each other.

So either your bank accepts bitcoins and allows you to trade them or, more likely, you'll have to find someone who buys bitcoins and then you transfer the money you received in exchange to your bank account.


Understanding Multi-threading (boost) in bitcoin initialization I am not familiar with boost in c++. Can any expert please explain in simple terms what is happening in the below code ? Is it like the logic in ThreadScriptCheck is scheduled to be run in background or how?

This is taken from bitcoin initialization (src/init.cpp). The classes are defined in src/scheduler.h

AppInit2():

// Assume value of nScriptCheckThreads is 4

if (nScriptCheckThreads) {
    for (int i=0; i<nScriptCheckThreads-1; i++)
        threadGroup.create_thread(&ThreadScriptCheck);
}

// Start the lightweight task scheduler thread
CScheduler::Function serviceLoop = boost::bind(&CScheduler::serviceQueue, &scheduler);
threadGroup.create_thread(boost::bind(&TraceThread<CScheduler::Function>, "scheduler", serviceLoop));

The boost::thread_group class doesn't do very much. It's basically just a container of threads. It doesn't really have any scheduling or dispatch functions. That this thread is part of a thread group doesn't really matter.

The CScheduler code allows a thread to run a task at a particular time. It requires a thread to run the various tasks that it schedules. This code creates a thread to runs those tasks for this CScheduler and adds it to the thread group.


How does the mathematical problem get harder for bitcoin mining over time? How does it become harder for miners to extract bitcoin as time passes (excluding increasing computer capabilities and the competition between miners accordingly)? Is related to the amount of bitcoins that could be extracted at that timestamp?

The Bitcoin blockchain has a property called the "difficulty" or "target", which is expressed as a 32-byte number. For a new block to be valid (among many other things) it's hash (another 32-byte number) must be arithmetically less than the target. This target value is adjusted after every 2,016 block period by a deterministic algorithm performed by all full nodes on the network.

Imagine if I asked you to flip a coin and if you got 3 "heads" in a row you win. How many attempts would you need to win? Once you win, I change the difficulty: now you must get 4 "heads" in a row... that will be harder for you and require more "computation" (attempts).

In Bitcoin, the difficulty adjustment algorithm looks at the time stamp of the block at the start and end of the 2,016-block period. If that time is greater than two weeks, the new difficulty target becomes "easier". If the blocks are being mined too fast, the difficulty becomes "harder".

further reading: Where exactly is the "off-by-one" difficulty bug?


Bitcoin Core frozen trying to sync and/or connecting to peers I downloaded Bitcoin Core directly to my laptop and sent BTC to what i believe is my wallet. The BTC is no longer in my senders wallet and I do not see it in my bitcoin core wallet. It was working slowly but now it is frozen at 12 percent.

Your wallet will need to sync to the network before your funds will be shown as available. This is because the ‘sync’ process involves your node verifying the history of transactions, so the transaction you received cannot be verified until all other preceding transactions have been verified first.

If you think it has frozen during the sync, I’d suggest turning the debugger on, and then looking at the debug.log file for clues on what the issue is.


Is there a limit in bits for the data hashed in hash-locked script? What is the limit in bits for the plain-text data of a secret (the data that it is actually hashed and used in a script) in a hash locked contract?

The maximum number of bytes pushable to the stack is set to 520 bytes, so that would be the maximum plain-text data of a secret (if you want to be able to redeem the output afterwards).

Another question discussing about this limit can be found here.


What is my chance to find a block on a TestNet ? My gethashespersec is 4806082,  on the TestNet what is my real chance to find a block ?

You have almost 5MH/s, so at the current difficulty = 1787.78664453 and given, that base diff for testnet is 0.5 diff for main btc network, you can put this into calculator, and you get

  9 days, 6 hours

. Hope this solves your case.


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

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


Who makes the decision about blocksize? I have been running a full node for little less than a year and I am following the discussion around blocksize increase. I am for it.

Who actually can make a decision whether  the blocksize increase gets committed to the bt core? Is a majority vote from core devs required? Obviously Gavin Andersen, an outspoken core developer is trying to convince someone with his blog posts. Whom?

Also how can the public coordinate their desire for blocksize increase? Everyone posting in their blogs is not going to cut it, or?

This situation is unprecedented in the software world. In other peer-to-peer systems (think Skype or Bittorrent or whatever), software updates fix bugs or add new features, and if the user doesn't update their software the worst that can happen is that their program will run with some problems.

In Bitcoin the situation is drastically different because the system is entirely based on reaching consensus on something. Bittorrent or Skype don't really need to reach consensus on anything. Sure there's still a protocol that clients should follow for the system to work as expected, but even if these rules are slightly different from client to client, overall the system still functions.

With Bitcoin, consensus is what makes the whole system possible. The rules behind how to reach consensus are embedded (actually hardcoded) inside the client/node that all the people are running. Now, if there's some clients that have different rules than others regarding the consensus, then the whole system branches into different versions creating effectively different versions of Bitcoin.

In fact, one can go ahead and say that Bitcoin is exactly the set of rules (the actual algorithm) to reach consensus. If you're not using those rules, you're not using Bitcoin, you're using something else (Bitcoin 2.0, Litecoin 2.0, whatever...).

Now you understand why this is really an unprecedented situation in the software world (perhaps apart from the fork of 2013). If you change the rules then you're effectively creating a new version of Bitcoin and you must make everyone move onto your new version - and I'm not talking about only miners here; all people that are running clients on their phones, or on their computers; all the web wallets; all the exchanges. They all must update their code otherwise you've essentially created another system which is not Bitcoin.

So to answer your question about "who makes the decision about the rules", it's the actual people running the bitcoin software that decide at the end of the day.

EDIT as was noted in the comments, regarding the specific block size issue, SPV clients don't actually need to be updated because they don't check the size of the blocks - they trust the miners will do the checking for them.


Which language has better Bitcoin API experience, C# or Node.js? At the moment it seems to me on the .NET side NBitcoin would compete with Bitcoin.js on the other.

Update: I decided on NBitcoin. It has a great book to learn from.
Note I will not form opinion on my question, I contributed a great chunk of this book, so I would be biased.

API selection with other technology selection is having major dependencies on final goal. so you have to select the best suit of technology as per the business requirement.


How is the balance checked by miners when new addresses are generated? How is it even possible to check all the transactions for balance when there are constantly new addresses being generated?

Bitcoin itself only needs to track the current set of spendable bitcoins.  It doesn't need to track bitcoins that have already been spent nor any information about who may receive bitcoins in the future (e.g. a new address).

When you create a new address, you don't have to register it anywhere (indeed, you can create the address completely offline), so there is no global tracking of new addresses.  By default, only your wallet tracks information related to a new address.  When someone spends money to that address, then Bitcoin full verification nodes begin to store the address, as it now controls spendable bitcoins.  When you spend those bitcoins, full nodes stop storing the address.  If you later receive more bitcoins to the same address, full nodes will start storing it again.

Some websites continue to store information about historic transactions so they can show every transaction that affected an address.  This is an interesting feature, but it's not directly related to what full nodes do.  Full nodes only store the information related to the current set of spendable bitcoins (plus some additional unindexed information necessary in case they need to recover from a problem).


Is it faster to retrieve bitcoins from exchanges than fiat? Quite often there are threads on various forums and complains on IRC channels that this or that exchange is not "playing nice" and has withdrawals (to a fiat currency like USD) taking a very long time. Very often invariably the excuse is that there has been a problem and that "employees are processing the backlogs" or something like that.

What about transferring bitcoins from the same exchange to your own bitcoin wallet? Is it something that also takes weeks and where the same excuses about backlogs are used? Or are the bitcoin transfer from exchanges to the wallet of your choice something that happens quite fast?

Just to give this a direct answer:

Yes, it's possible for coin withdrawals from an exchange to be processed instantly, and as far as I know most exchanges actually do so.


Segwit & Offline Signing Yesterday Trezor released details of a segwit-related hardware wallet vulnerability.

The writeup claims that providing full previous transactions to the hardware wallet prevents the exploit.

My question: Why can't the compromised desktop software provide fake previous transactions corresponding to the fake inputs?

Using the example in the writeup:

In "step 2", create a fake transaction containing an output spent by "input 2" with value  5.00000001 BTC and same outpoint as the 20BTC UTXO.
In "step 5", create a fake transaction containing an output spent by "input 1" with value 0.00000001 BTC and same outpoint as the 15BTC UTXO.

The offline signer couldn't know that these fake transactions aren't on the blockchain. Most hardware wallets don't show information about the UTXOs being consumed so the user couldn't catch it by inspection. Does the fix involve incompatible sighash values for the two rounds?

Answered on Twitter

  The hash of the provided prevtx must match the prevtx hash given in the input. The attacker is unable to construct a fake prevtx that hashes to a predefined value. The prevtx hash in the input cannot be changed either, otherwise the network will reject the tx.

Basically, you can't create fake previous transactions because that would require producing a sha256 collision, which we assume can't happen.


How to recover corrupted Electrum wallet.dat I invested in bitcoins at the beginning of 2015. At the same time back in 2015, i installed Electrum wallet and somehow an offline version which meant that I stored the bitcoins on the computer's hard drive, this offline version was not something I wanted, it just happened by a mistake. Once the bitcoins were sent to my Wallet, it took about 3 days until the hard drive crashed.
A good friend managed to get into the hard drive via the wrong safe mode, and ran a backup of all important files, including the files to Electrum, including my wallet.dat file, which I have understood is a relatively important file.
I bought a new computer and downloaded the files from my backup and tried to restore my wallet, but I could not solve this.
An error message appeared when I tried to access / restore Electrum. When I tried to open the wallet file in a program called something with HEX, (which people had written about in diffrent forums), it stod ”the file is corrupt” according to the program.
I let it all go and more or less forgot this until now. I have read and i was thinking, could the reason why the file apears to be "corrupt" , just because its  encrypted? I know the password for the encryption and I have just finally finished syncing the Bitcoin core. But i dont now how to decrypt it, and is my idea about the file issue, possible?
What is my next step to recover my bitcoins?

If the file is corrupt, it will require manual editing to be able to open it with electrum.
Depending on how corrupt the file is, it might be possible to recover and and it also might not.
Say, for example, a single bit is flipped. Then a brute-force approach might work where every bit is flipped in the file and then check which result can be opened and decrypted with electrum..
Check with electrum developers who are most familiar with how a non-corrupt file should look.
If I were in this situation myself, what I would also do is generate a few new wallet.dat files using the same electrum version you used in 2015, open them in hex viewers / text editors next to each other, and try to see the patterns. Compare to your corrupt file.
Good luck.


Bitcoin Core Wallet doesn't accept my passphrase I am using Bitcoin Core Wallet .21 and have encrypted my wallet.
When I try to send some coins it asks for the passphrase, which it says is incorrect.
I have only ever used one of two passphrases and I have copied and pasted these each time using notepad (upper and lower cases), but it rejects my passphrase every time. There is nothing wrong with my passphrase, I know my passphrase is correct.
Are there any circumstances under which the wallet would behave like this?
I have used old backup files of my wallet, but get the same message.
Could my wallet be corrupt and if so can it be repaired anyway?

Are there any circumstances under which the wallet would behave like this?

If your passphrase contains non-ASCII characters, then you could have an encoding issue. I would try typing in the pass-phrase rather than cutting it out of Notepad and pasting it.
Unicode has multiple normalisation forms and this is another thing that could theoretically trip up software.

Could my wallet be corrupt ...

Yes, but your backups show the same result. If you successfully used the passphrase anytime after making a backup it is very unlikely that wallet corruption is the cause.

... and if so can it be repaired anyway?

No-one can tell you that. Repairing an encrypted file is improbable.


p2pkh vs. p2pk keeping public key private I just got into learning Bitcoin programming through Jimmy Song's Programming Bitcoin.
Jimmy says that some of p2pkh's advantages over p2pk include:

a smaller ScriptPubKey

keeping one's public key private

I completely agree with the first advantage but I'm having a little trouble with the second advantage.
Jimmy explains that, if ECDSA was every broken, one could steal bitcoin from another entity because they could find their public key in the ScriptPubKey (if they were using p2pk) and create a valid signature.
My question is: If all we are doing is moving the public key from the ScriptPubKey to the ScriptSig, what security does that grant us if the ScriptSig is also accessible? If I was to spend a UTXO that was made to my public key hash, my public key would be public. Couldn't a malicious user who had broken ECDSA keep looking for a UTXO ScriptPubKey with my hash in it, copy my public key from the previous transaction, generate a signature, and steal my bitcoin? It seems to me that my public key is private as long as I don't spend anything.
Of course, I know I'm missing something :) Any help is appreciated.

Bitcoin addresses, and the public key by extension, should ideally only ever be used once. So your time of exposure of the public key in P2PKH  is the time between when the spend is made and when it confirms. For P2PK the public key is always known to everybody. There's a considerable difference between the two.


Bitcoin transaction fees and exchanges When Bitcoin started off, I thought one of the advantages was that there was very little transaction fees. However , now to send bitcoins to another address(exchange independent), I have to set a rate for it to be included in the blockchain. At some point when there are so many transaction, but miners have reduced, would the transaction fee not become very high?

The second question I have is what are the good decentralized exchanges(like bisq), but which do not require any bitcoins for me to start? It seems to be that the price on localbitcoins is pretty high compared to exchange rate. How do I find someone who is ready to sell me some bitcoins at the market rate and avoid exchange fees(different from the transaction fees I talked about earlier in the first question.)

Bitcoin was never really meant to have no/low transactions fees.  What was always intended (and still is true) was to have market driven transaction fees.  In fact, as block rewards grow smaller, the plan has always been to eventually compensate miners from fees alone.  Because transactions take up space in a block, and block space is limited, there is a basic economic supply/demand curve at work.  There are many improvements being made to shrink the space that a transaction takes in a block, which effectively increases the supply.  However, as Bitcoin becomes more popular, demand is also on the rise.  In addition, there are layer-2 solutions such as the Lightning Network that only uses the blockchain for settlement, and performs off-chain transactions for common use.  This could also increase the supply, but may also increase the utility enough that demand also skyrockets.  There is a long-standing debate about how to scale Bitcoin, and your question about transaction fees sits right in the middle of it.

Concerning your inquiry for decentralized exchanges between Bitcoin and fiat currencies...

  How do I find someone who is ready to sell me some bitcoins at the market rate and avoid exchange fees

You are trying to have your cake and eat it too.  If you don't want to pay fees, don't expect market rate.  That market rate is really the "market with fees" rate, meaning that there is a separate "market without fees" rate.  The latter is the market you are in when using localbitcoins.  If you don't want fees, you'll pay a higher rate.


New to BitCoin - Purchased Coins but they haven't shown up in my wallet yet - Wallet still syncing I purchased some BitCoins last night.  I downloaded the BitCoin client around a year ago but and only had it open once or twice for just a short time.

Because of that, my wallet is still synchronizing and looks like it will continue doing so for quite some time.  lol

Needless to say, my wallet is still at zero...  Did I screw myself over by transferring coins before my wallet ever initially synced?

It was a small, small amount thankfully, just to try it out (as I said, I'm a newbie).  :)

Any help is appreciated it.

Thanks!

Just wait for your wallet to synchronize.  It won't show up in your wallet until you have the block that contains the transaction, which would be a very recent block.


Sending from same address multiple times VS receiving to the same address multiple times Is it completely safe to have multiple transactions sent to the same address?
I have read that "using" the same address multiple times could be unwise.
Does this refer to "sending from" or "receiving" or both?

This is a weird question because you have to send from the address you receive from.  If you receive all your bitcoin to the same address, you will inevitably be spending from that same address as well.

When you receive to the same address, it ties together the addresses that are paying you.  If you are running a business, this could allow chain analysis to figure out who your customers are.  This might be bad for your business, and it might be bad for your customers.  Giving customers a fresh address for each transaction will give you and your customers the most privacy.

When you send from the same address, chain analysis can determine how you spend your money.  Also, consider addresses used for "change" outputs.  If you re-use the spending address as a change address, it makes it very easy to detect which output is the amount being spent, and which one is your change in the transaction.  This now makes your purchasing habits even more obvious to anyone who is watching.

For best practice, always use a new address for receiving bitcoin, and always use a new change address each time you spend it.


Why does blockchain.info show a different balance from bitcoin-qt? I just created a wallet on blockchain.info by importing my wallet.dat from Bitcoin-QT. My Bitcoin-QT shows a balance of 3.991 BTC, while blockchain.info shows a balance of 3.016.

Where does the difference come from, and which one is 'correct'?

Either one of the factors may affect either balance:

There is a double spend against one of your accounts
Some transaction might not have yet been included in a block and one program does not see it yet
There can be an error in one of the programs that skipped over some transactions. In case of the client, you should try rescanning the blockchain to make sure all data is properly extracted in case you suspect an error

You should make sure your client is fully synchronised and all your transactions have at least one confirmation.

You should generally trust the place where you issue your transactions from to have an accurate balance of your outgoing transactions, and blockchain.info for the information available everywhere else.


What do the options in Bitcoin Core's wallet creation mean? I'm a newbie and today I have wanted to create a new wallet and I have confused when Bitcoin Core (v. 0.21) has asked me for additional information.
It asks me:

Encrypt wallet - Encrypt wallet by a password.
Disable Private Keys - ???
Make Blank Wallet - ???
Descriptor Wallet - ???

What do these ??? mean?
What is the difference between Enable\Disable Private Keys?
Whare can I read detailed information?
I have found reviews only on the Internet and they have had two or three sentences about my questions.
Can anyone explain to me what does it mean?

Disable Private Keys
the wallet is set in watch-only mode, only public keys can be imported into wallet.
You can use it, for example, to track transactions or generate PSBT transactions to be signed elsewhere.
(if this option is enabled you don't need Encrypt Wallet, because only private keys are encrypted)
Make Blank Wallet
the wallet starts out with nothing in it, but private keys can be added later to the wallet via import or sethdseed.
(this is needed if you set Disable Private Keys)
Descriptor Wallet
A descriptor wallet is one which stores output descriptors and uses them to create addresses and sign transactions.
Wallets that use descriptors internally shouldn't have any noticeable effect to the user, they should only be handled when users want to import their wallet.
(for further info you can see here:  What are output descriptors?)
You can also find other useful info here:
Bitcoin Core 0.21.0 Release Notes
What's Coming To The Bitcoin Core Wallet in 0.21 by Andrew Chow


How to verify Bitcoin Core Release Signing Keys I use Gpg4win but I don't know the step to verify the Bitcoin Core Release. can you give me the instruction how to verify released?

i git this resolte
C:\WINDOWS\system32>gpg2 --keyserver pgp.mit.edu --recv-keys 0x90C8019E36C2E964
gpg: conversion from utf-8' toCP720' not available
gpg: requesting key 36C2E964 from hkp server pgp.mit.edu
gpg: key 36C2E964: "Wladimir J. van der Laan (Bitcoin Core binary release signing key) " not changed
gpg: Total number processed: 1
gpg:              unchanged: 1

This answer depends on that you are using Bitcoin Core 0.13.1 and you have downloaded bitcoin-0.13.1-win64.zip, this answer will also work with any other bitcoin version or download with only change signer public key, checksum file and bitcoin download name.

First you need to import public key of the signer, in this case the key with id: 0x90C8019E36C2E964, you do that by --recv-keys command line argument.

gpg2 --keyserver pgp.mit.edu --recv-keys 0x90C8019E36C2E964

Or you can manually download it from: http://pgp.mit.edu/pks/lookup?op=get&search=0x90C8019E36C2E964

Next you need to download the signature file from her: https://bitcoin.org/bin/bitcoin-core-0.13.1/SHA256SUMS.asc, and store it in same folder where bitcoin core download is stored. Then you need to check that the SHA256 checksum is valid.

sha256sum --check SHA256SUMS.asc

Don't care about FAILED open or read or No such file or directory messages, you are looking for something like this:

bitcoin-0.13.1-win64.zip: OK

If the checksum is valid, then you validate that the signature is good (checking that the checksums file is not tampered with). This is done by:

gpg2 --verify SHA256SUMS.asc

This should output something like this:

gpg: Signature made Thu 27 Oct 2016 08:21:11 PM CEST
gpg:                using RSA key 0x90C8019E36C2E964
gpg: Good signature from "Wladimir J. van der Laan (Bitcoin Core binary release signing key) <laanwj@gmail.com>"

EDIT:
If you get following message:

gpg: WARNING: This key is not certified with a trusted signature!
gpg: There is no indication that the signature belongs to the owner.
Primary key fingerprint: 01EA 5486 DE18 A882 D4C2 6845 90C8 019E 36C2 E964

You have problems with trust, in other words, the public key for Wladimir J. van der Laan is not marked as a trusted key in gpg. You can mark it with some easy steps.

gpg2 --edit-key 0x90C8019E36C2E964 ↵
trust ↵
5 ↵
quit ↵

You don't need to use 5 as trust, you can choose 1-5:

1 = I don't know or won't say
2 = I do NOT trust
3 = I trust marginally
4 = I trust fully
5 = I trust ultimately


what is the mathematical problem in each block which is difficult to solve? in blocks page it says each block has a solution to solve difficult mathematical puzzle, what is that difficult mathematical puzzle?

That difficult mathematical puzzle is finding a block that can legally follow the previous block. To follow the previous block, a block must meet a set of requirements. First, it must contain the hash of the previous block. That means you can't even start solving the problem until the previous block is found.

The key one is that the hash of the block must meet a target. For example, the hash of a recently-found block is:

000000000000000049f4701e8ac6dc62abd4a951363535697f1553963429a28e

Notice all those zeroes at the beginning? You would have to try quadrillions of candidate blocks before you find one with a hash with so many leading zero bits.


Using segwit and creating Pay-To-Witness (P2WPKH) addresses I'm going through this guide: https://bitcoincore.org/en/segwit_wallet_dev/

I might be understanding this incorrectly, but it sounds like the users and/or wallet custodian (coinbase, blockchain.info, etc) must create P2SH-P2WPKH addresses in order for the witness data to be segregated and save on block space.  According to the guide, soon after activation only a limited number of segwit transactions will be on the network.

Does the new release 0.13.1 default to creating P2WPKH addresses or will the users and online wallet providers have to do this manually?  Will there be a built-in RPC function for creating these addresses similar to createmultisig ?

I might be understanding this incorrectly, but it sounds like the users and/or wallet custodian (coinbase, blockchain.info, etc) must create a P2SH-P2WPKH addresses in order for the witness data to be segregated and save on block space.

Correct, you first have to receive money to a SegWit address. Witness space can only be used when spending outputs received on a SegWit address. The bitcoins can be sent to any type of address from a SegWit input, though.

  Does the new release 0.13.1 default to creating P2WPKH addresses or will the users and online wallet providers have to do this manually? Will there be a built-in RPC function for creating these addresses similar to createmultisig ?

SegWit transactions created before the activation of SegWit could lead to permanent loss of funds, therefore, 0.13.1 will not create SegWit addresses or transactions by default.

→ Please consider the section Upgrade Safety in Bitcoin Core's SegWit Wallet Developer Guide carefully.


Can my 10,000 satoshi channel with a large LN node receive multiple LN payments that are larger than the amount in the channel? Can my LN channel for some amount "X" receive a LN payement larger than "X"..or receive multiple small payments that exceed "X"?

For example, say I have an online tea store and have one 100,000 satoshi channel opened with one of the big LN nodes out there (e.g., acinq, one of LNbig's nodes)...my thinking being, well I want to keep expenses down in opening up channels, and the big node I'm connected to will connect with a lot of people that want to buy from my online tea store.

However, say my store has one item that is 10,000 satoshi and one item that is 1,000,000 satoshi.

What happens if:

(1) I receive fifteen 10,000 satoshi order/payments routed via the 100k big LN node channel...or

(2) I receive one 1,000,000 payment routed to me via the 100k big node channel (a purchase of my one "expensive" 1,000,000 item).

I believe to run my store I would need to create multiple giant channels to accommodate any potential payments received...right? So in both cases above, the channel must have enough to receive the payments and cannot receive a payment larger than what is in the channel.

Can my LN channel for some amount "X" receive a LN payement larger than "X"

No, you can only receive payments until the entire channel capacity ("X") has been pushed to you side of the channel. At that point, you will no longer have incoming capacity.

..or receive multiple small payments that exceed "X"?

You could receive multiple payments that exceed "X", but you would also have to send payments out in between the receives (to push the channel balance back to your channel counterparty's node).

What happens if:
(1) I receive fifteen 10,000 satoshi order/payments routed via the 100k big LN node channel...or

Assuming your channel starts with 100% of the capacity on your counterparty's node, you would be able to receive 9-10 payments, and then there would be no route to complete the last 5-6 payments.
I say 9-10 instead of 10, because each node involved in a channel must keep a small amount of capacity in reserve, to initiate a channel closing in case of an uncooperative closure. So if the capacity was exact 100,000 sat, and the payments were exactly 10,000 sat, then you would most likely not be able to receive the full 100,000 sat in payments consecutively, due to this reserve requirement,

What happens if:
(2) I receive one 1,000,000 payment routed to me via the 100k big node channel (a purchase of my one "expensive" 1,000,000 item).

The same as above, you might be unable to receive that payment, due to the reserve requirements.

I believe to run my store I would need to create multiple giant channels to accommodate any potential payments received...right? So in both cases above, the channel must have enough to receive the payments and cannot receive a payment larger than what is in the channel.

Right, you cannot receive a payment larger than your current incoming capacity on that channel (the remote_balance). As a shop owner, you can actively maintain channels with incoming capacity, but you could also allow customers to open channels with you directly. There are also services forming that allow you to buy incoming capacity, etc.


blockchain.info api for tor hidden services I would like to use blockchain.info "recieve payment" api for my hidden service, but would like opinion on the following considerations:

Will it be possible to use blockchain.info api for hidden services
Will blockchain.info allow tor connections
will the ip of my hidden server be compromised (broadcasted)

Currently I do not think it is possible, atleast not without remaining "hidden".  What you could do is configure your bitcoind server to use a proxy: https://en.bitcoin.it/wiki/Tor

Other alternatives you may want to look into is BitPay as they are currently working on a tor implementation: https://github.com/bitpay/bitcore/pull/210

Also BitWasp will be releasing their marketplace soon which you will be able to configure to run on the Tor network as well.


Why doesn't getblockchaininfo reveal BIP9 signaling statistics? An example of the output of getblockchaininfo is here:

https://chainquery.com/bitcoin-api/getblockchaininfo

The softforks field describes the number of required / found blocks signaling the soft fork, but the bip9_softforks field does not. It just indicates a generic status message ("defined", "started", "locked_in", "active", "failed").

Is there an RPC command that will return the number of SegWit blocks?

The answer is pretty boring. Nobody did the work to implement it (yet).


Is Ripple.com scalable? What is the Ripple equivalent to https://en.bitcoin.it/wiki/Scalability ?

The limitations on Ripple scalability are substantially the same as the limits of Bitcoin scalability. There are various minor differences, but they don't significantly change the picture.

Ripple already has some scalability features that Bitcoin doesn't have yet, but Bitcoin can easily add them when it needs them. For example:

Ripple nodes don't need to keep history to process transactions.
Ripple nodes can form "clusters" under common administration that divide the cryptographic work.
Ripple nodes can escalate the transaction fees they demand to forward transactions in response to load bursts.

One difference is that Ripple's confirmation time can increase with load. In a sense, Bitcoin's confirmation time can increase with load too as you may need to wait longer to get a transaction in a block. But Ripple's consensus process can take longer if more nodes are participating in it or if a higher transaction level creates more disagreements that must be resolved in the consensus process.

Right now, consensus consistently takes about 2 seconds (which is the minimum). In simulations, the consensus process increases with the log of the number of trusted validators. 100 validators brings it to about 3 seconds. 1,000 validators increases it to about 4 seconds. 10,000 increases it to about 5 seconds.

Consensus time also increases, though by much less, with the transaction rate. Note that consensus time is just one factor in the time it takes to confirm a transaction, though as the network grows it will likely be the dominant factor.


I Want To Confirm That My Bitcoins Are Being Held In New Wallet I sent a couple bitcoin from one of my trezor wallets to a different trezor wallet.

I don't know the details about how bitcoin "sending" between wallets work, and now I feel the need to confirm that it all went smoothly. Essentially, I'd like to see confirmation that all my bitcoin transfered to to my new wallet.

the receiving address of the new wallet, (the one thats supposed to be holding the bitcoin now), is: 1HyETxKBZshfu2cdjEWMYntDFabFXsrHe2

Can someone help me out here? How do I check to see if everything went over to the new wallet?

Thanks!

You can check on 3rd-party pages whether they have knowledge of your transaction: E.g. Blockexplorer shows that address 1HyETxKBZshfu2cdjEWMYntDFabFXsrHe2 received just short of 35 BTC last week. If that's the amount you sent, you were successful.


Is it possible to trace bitcoin ATM withdrawals? If someone is tracking how BTC are being spent or transferred between wallets, is it possible to concretely determine which transfers constitute conversion into fiat currency at an ATM, and possibly a specific ATM? If so how?

That would depend on the owner/operator of the ATM, and your relationship with them.  Normally, you will need to register with a Bitcoin ATM company in order to use their machines.  This is so that the company can comply with local laws and regulations, just like exchanges need to comply.  Effectively, Bitcoin ATMs are not "automatic teller machines", but rather "automatic exchange machines".

By looking at the blockchain alone, it would be hard to determine whether a transaction was received by or sent from an ATM.  However, if the party operating the ATM were to open their records to whomever is tracking, then it would be trivial for them to report who used the ATM, where it was located, and the exchange rate you received at the time.

Basically, it's the same as using an exchange.


What money transmission licences are relevant to Bitcoin? Tradehill was shutdown for various regulation issues, including not having the required money transmission licenses.

What were the money transmission licenses that were required?

What other compliance rules should be followed?

Tradehill got shutdown because it went bankrupt when Dwolla started reversing money transfers made to them despite their terms of service stating that no chargebacks could occur (at the time). There is currently a lawsuit pending.

The required licenses will vary depending on the legal context and the interpretation of the business, made by the relevant legal authorities.

There is a lot of legal uncertainty surrounding Bitcoin, but there is one thing that is pretty certain : in all jursidictions you need a license to maintain fiat-denominated balances on behalf of third-parties.


In theory could we skip the proposed Taproot soft fork, activate Simplicity instead and use Simplicity to write the equivalent of Taproot scripts? In theory could we skip the proposed Taproot soft fork, activate Simplicity instead and use Simplicity to write the equivalent of Taproot scripts? Or does Simplicity need more development and maturation?
This question has been paraphrased and was initially asked by JWWeatherman_ on Twitter.

I think that's both very premature, and misses the point.
Simplicity is a completely different approach to scripting, with significant advantages, but it's being designed from the ground up. There is lots of progress, but it will require more than just the base layer.
You can't just write scripts in Simplicity, and if you have one, you can't just sign for it. There is work on improving that, by building something Miniscript-like for Simplicity, but it's all a long way from being usable & integratable.
And even ignoring all that, if Simplicity was completely ready and usable and reviewed and everything... it would be strongly preferable to integrate it as a leaf version under Taproot. Doing it otherwise would remove some of the incentives for hiding policies that Taproot offers.

This question was answered by Pieter Wuille on Twitter.


A Bitcoin alternative with non decreasing reward Understanding the motivations for the 21 million BC limit and halving reward rate, I still think it dis-proportionally rewards early adopters. My ideal system would be one where the mining reward is a factor of the work done which would mean as the system increases in popularity (i.e more miners) the corresponding mining reward would increase. This would have a stabilising effect on the price and provide people a reason to spend coins rather than hoard them. Anyone who has tried to work or sell goods in BC's would see the problems it is facing as a currency rather than a commodity. Does anyone know of a Bitcoin alternative with these properties?

PPCoin appears to have a non-reducing block reward, so that might be what you're looking for.

Other alternative cryptocurrencies are listed, with some info on their properties, here:
https://en.bitcoin.it/wiki/List_of_alternative_cryptocurrencies


Does btc-e require verification for coin to USD conversion I know that btc-e requires verification to withdrawal USD,
but do they require verification to convert to USD and let sit until I want to trade it for other coins?

Again.. NO usd withrawal. only BTC->USD -- USD->BTC/LTC/etc

I use them for my primary exchange. You can sell BTC/LTC/etc. for USD and hold the USD in your account without verification. As far as I can tell, there is no verification process nor a way to withdraw USD other than as a BTC-E credit. In my experience, you're better off finding a reliable third party that specializes in buying BTC when you are ready to cash out.


Trading ERC-20 based token The 12th of February 2017 numerai gave 1M NMR to 12K users.
NMR is based on ERC-20 (ethereum protocol). I was one of the lucky receivers. A few months later, crypto exchanges started trading with NMR and I sold my share.

In my country, the authorities started taxing cryptos with retrospective effect.

There is one way I can avoid paying tax: If the crypto was worthless or untradeable at the time I received it.

Question: Was it (theoretically) possible for me to trade the NMR at the time I received them (12th of February 2017)?

It was not on the blockchain at that point.
It was announced in February:
https://medium.com/numerai/numeraire-the-cryptocurrency-powering-the-world-hedge-fund-5674b7dd73fe

Live:
https://medium.com/numerai/an-ai-hedge-fund-goes-live-on-ethereum-a80470c6b681


How to get my c-lightning node's private key? lightning-cli getinfo outputs my node's id, which is its public key. How can I get its underlying private key?

c-lightning uses this code to obtain the node's private key from the hsm_secret.

I've came up with a way to do the same using Python and posted my highly-commented tutorial-like code in this gist.

Basically you have to call an hkdf function with the hsm_secret contents, a salt which will usually be zero, \x00, and the label "nodeid".


How can I tell if my Bitcoin wallet is working? I'm not sure if my Bitcoin wallet is working, is there a way to check that it's ready to go? I'm using Breadwallet for iOS.

breadwallet is a standalone bitcoin client for mobile devices. There is no server which can get hacked or go offline, so you can always access the funds stored on your phone.

Using SPV mode, breadwallet connects directly to the bitcoin network with the fast performance you need on a mobile device.

Since the wallet itself has no indicator for connections and does not synchronize the blockchain, I would suggest that you use a very tiny amount of Bitcoin and send it in a micro transaction to your breadwallet to test if you are set up and connected.

By the way, did you backup your wallet yet?


Can can I identify my deposits to a wallet on a BTC (or LTC) blockchain (using the blockcypher api) I'm trying to reconcile my deposits to a wallet (happens to be LTC) on an exchange account with the data on the blockchain.  I was using the logic:

if tx_input_n is -1 then
    transaction is a deposit
else
    transaction isn't a deposit

Which I now know isn't correct.  In this this wallet for example: http://explorer.litecoin.net/address/37GjCWCfLuxMaeKZz5yepLSS1Jpd3MfKmG, there are 20 blockchain deposits using the logic I've described.  5 of them however are (correctly) not represented in my exchange account because they aren't deposits:

2017-07-22T10:56:32Z b9ed3bbf129307b0a36fbb723e3a11d40959b4e109c01983a8ee2f0589cf52e5 0.02873313LTC
2017-07-28T14:40:44Z 2440d14ba777ac204b332f2e2043f415cb0d10670b4ca4f4b38284d3c8bbf9ef 4.61365117LTC
2017-07-28T14:51:26Z baf74fe93ade6f9dc8a15a2e5b6ac5923bb9cd40877a493933ffc21384538f24 18.03466901LTC
2017-07-28T22:46:47Z c55c669edf7bcd2c6a334269f13d93a00e1d6785304af4e389376ccfc3503261 5.89897287LTC
2017-07-31T14:42:27Z 6743cb062ab904a050adc90933f0cc02e4188073a7ff3f0e552576431230dc84 10.79192514LTC

What are these 5 transactions?  Or more specifically: how do I identify my deposits in the blockchain so that I can reconcile them with my exchange account?

An old post, but why not.
1st, the example address is MDUsWPcdJ2onP9bU5xxzdygqL1R51aAvva. It has 31 total transactions:
https://longhorn.bullpay.com/?gateway=6&data=MDUsWPcdJ2onP9bU5xxzdygqL1R51aAvva

The first transaction is this one:
https://longhorn.bullpay.com/?gateway=6&data=b9ed3bbf129307b0a36fbb723e3a11d40959b4e109c01983a8ee2f0589cf52e5+

45 LTC was taken from the given address and bundled with 16 other inputs. 48 LTC was snet to LSd8c9iv8JuyFbi3ejEAdpqPcdRyhsiF4H and the remaining .02873313 LTC was returned to the MDU address.

What you are likely seeing here is change. To send that 48 from MDU it had to bundle together enough to cover the 48 along with the ~0.68 fee. The remainder was returned to MDU as change.

In your second example,
https://longhorn.bullpay.com/?gateway=6&data=2440d14ba777ac204b332f2e2043f415cb0d10670b4ca4f4b38284d3c8bbf9ef+

This transaction took multiple inputs from the MDU address along with a few others to cover what looks like the Lgam transaction of 10.7 LTC. This seems like a sloppy way of handling the inputs as the change resulted in more than one of the MDU inputs. Seems like juggling the inputs for no reason only to have it come back to the same address. Waste of gas in my opinion. The 3.09299- MDU input could have been dropped completely and this transaction would have still been fine.

I could go through the remainder but at this point i'd prefer more information.

Which exchange are you using?
What does the exchange say are you deposits/withdrawals (line by line)?
What is your actual exchange "deposit" address?

I'm not sure you want to tell me exactly what your wallet is, if it is indeed this one. Ultimately exchanges in most cases don't let you "own" your wallet. You don't have the private key to it, it's shared among many other accounts. You "own" the number next to "LTC" and they juggle everything else as they see fit.


What makes a transaction a SegWit transaction or a non-SegWit transaction? Can we say that if there is at least 1 input with a legacy script then the tx is a non-segwit transaction?

It depends for what purpose.
When do segwit validation rules apply?
P2WPKH/P2WSH script validity rules apply on a per-input basis.
Only inputs that spend a segwit output can have a non-empty witness.
When is extended serialization used?
BIP144 defines a new way for serializing transactions. It is used whenever at least one input has a non-empty witness. It cannot be used when all witnesses are empty (as is the case for legacy spends).
When do the malleability protections afforded by segwit apply?
Only when all (relevant) inputs are segwit inputs do these protections work. However, say a transaction has a multisig segwit input and a legacy single-sig input from yourself, you may be fine, as the single-sig input may be considered non-malleable.


What if the blockchain saved space by trimming input txs on each transaction? At each block there is a determined set of unspent transaction outputs. Each new transaction specifies the unspent outputs it's going to spend in the format tx_id:output_index. tx_id is 32 bytes.

If at any point in time an unspent output has tx_id = cb7f357d7034f93b89a227c2109182740f1798f5a006e9cd0930a380c06aca7e and no other unspent output has a tx_id with prefix cb7f35 a new transaction could reference only cb7f35 and everything would still be exactly determined.

Prefix sizes could be adjustable.

If there were more than one unspent transactions with the same tx_id at each point any mempool transaction trying to spend from an ambiguous prefix would become invalid and a new one with a bigger prefix would have to be issued.

This could save up to 5GB of disk space in an year according to my stupid naïve math.

This could be implemented either:

In the raw Bitcoin protocol, so the canonical blocks would have only prefixes;
As a way to "compact" stored blockchain data without using fancy compression algorithms and without losing the data structure.

So, considering the two potential usages above and not mentioning that this is not doable without a hard-fork (therefore impossible); that is is silly; that disk space is not the biggest bottleneck; and that it isn't worth doing due to practicality and low cost-benefit, why is this a bad idea?

I see two problems here:
First problem is collision, since you chose only 24 bit out of 256 bit. You'll have to use a much bigger short form to mitigate that, so the big space you saved is now a lot smaller.

Second problem is when you have to convert the short form to the long form. Lets say you stored the outpoint of the tx as cb7f35:index, now another node wants the block containing this tx. To reply, you have to construct this outpoint in its long form first. The only way to do that is to go through the entire history and find the long txid cb7f357d7034f93b89a227c2109182740f1798f5a006e9cd0930a380c06aca7e and send that. That process takes a lot of time, you could however index the blockchain based on txids but then you'll need an extra space to store the index that negates the space you saved.
You could not communicate with the network (don't relay blocks) to avoid all that, but why store the blockchain in first place? A better solution would be "pruning" it.