How to detect that full node is in sync (using jsonrpc)? I have full bitcoin node available through jsonrpc interface. How my app can detect if this node  is in sync with the network?

Using the getblockchaininfo RPC command :

if initialblockdownload is true, your node is currently syncing with the network for the first time.
else :

if the headers field number is superior to the blocks field number, your node is catching up with the current state (likely after having been restarted)
else if the headers field number is equal to the blocks field number, your node is synced !

Here is the current output of the command for me :

$ bitcoin-cli getblockchaininfo
{
  "chain": "main",
  "blocks": 634379,
  "headers": 634379,
  "bestblockhash": "000000000000000000136f1b78deeebc33a9b7b33d25c2e37f5446cb33b586fd",
  "difficulty": 13732352106018.34,
  "mediantime": 1591963775,
  "verificationprogress": 0.9999999385944023,
  "initialblockdownload": false,
  "chainwork": "0000000000000000000000000000000000000000104a35fae53a5b470d8e9524",
--snip--
}


Coin minable from browser I was wondering if there is a coin that can be mined in a browser? So I can remove the dreaded ads from my website.

Yes. Mining in your browser means mining with CPU. There are a lot of coins that focus on CPU-mining. Of course, Bitcoin is not one of them as ASIC-mining is much more effizient.

There is a useful list of coins:

  The CPU Coin List is a sortable list of Alternate Cryptocurrencies (Altcoins) that can be mined on your CPU

http://cpucoinlist.com/

By the way: Mining in the browser already happens. There is coinhive ( https://coinhive.com/ ) for example. They offer a script you can implement into the sourcecode of your website. If someone visits the site with activated javascript, the mining starts automaticly. The mined cryptocurrency is Monero.


Mining with multiple older computers Is it worth using about 20 old dell workstations to mine at once? They have ancient hardware from about 2003-2005. Would it be better to use than one computer from modern time?

I wouldn't use them to mine.

Since GPUs back then couldn't do arbitrary calculations, the only thing you can use are the CPUs. CPUs are relatively better at mining scrypt (e.g. Litecoin) than SHA256 (e.g. Bitcoin), so let's go with that. Based on the oldest CPUs listed (which aren't quite old enough) on Litecoin's wiki, I'm going to guess that each computer can do 5 kH/s, which is probably being too generous. So that's a total of 100 kH/s. Plugging that into a calculator, even with assuming (another probably-too-generous assumption) 500 W total are used (that wouldn't otherwise be used), you're losing money if you have to pay for the electricity and/or cooling. (making maybe $0.14 per day, pre-expenses)

For comparison, a modern GPU can mine around 1400 kH/s for ~500 W ($2.01/day pre-expenses). Or a dedicated Bitcoin miner could actually turn a profit ($4.84/day pre-epenses) in a reasonable amount of time (of course, you're basically betting on/investing in the future of Bitcoin by buying something like that, which involves a good deal of risk/uncertainty).


Mining in a down market Is there something in the design of the bitcoin system that prevents this scenario?

The price of bitcoins drops by 80% (or some number) for some external reason.
The profitability of bitcoin mining drops significantly.
The number of bitcoin verifications drops significantly, causing
Additional drop in the price of bitcoins because transactions are not verified promptly.
Go to 2.

In other words, what happens if people stop bitcoin mining because it's too expensive? How will transactions be verified?

Eventually, the difficulty will drop. This will cause the mining to increase. This will cause an increase in the price because the verification problem holding the price down is gone.

There's another factor too -- once you've bought mining hardware, the cost of the hardware is a sunk cost. So long as it can pay for its electricity, you'll keep it running. A typical mining rig today produces Bitcoins worth about 60 times its cost of electricity (1W/GH/s). So the price would have to drop astronomically for people to stop mining.

It could, of course, significantly reduce the incentive for miners to invest in new equipment. But that will just keep the difficulty from rising. It won't significantly slow confirmations.

Also, people might see that the difficulty is going to drop and the price is going to come back up. So they might see this as a great opportunity to get new mining hardware in place in expectation of the easier mining.


Who provides a Bitcoin recurring payments API? Is it possible to send recurring bitcoin payments via the bitcoin protocol? Is there a service which provides an API to do so?

There is no ready-made recurring payment solution at the moment, however this can be achieved at application level by constructing pre-signed transactions or using CLTV's as @Wapac suggested. CLTV approach may have a downside though, you will be paying transaction fees twice in case you decide to cancel.

A more sophisticated mechanism may be creating a non-custodial, multi-sig wallet service that keeps track of your recurring payments and notify you if any action is needed. Disclosure, I am involved in such a solution called: https://www.arf.one


How do i find bitcoinadress? I am wondering where do I find the bitcoin address?
I want to buy some bitcoins but I don't know what to put in for bitcoin adress.

You need to have a bitcoin address in order to send and receive bitcoins. To do this, choose a bitcoin exchanger to set up one.


Shared Coin in BlockChain new wallet? How can I send Shared Coins using BlockChain new wallet?!

I can't find that option in the new wallet!

You cannot. That feature has been was "temporarily" cancelled due to numerous reports of stuck transactions and growing awareness of its privacy limitations:

https://blog.blockchain.com/2014/03/17/shared-coin-suspended-temporarily/

http://www.coindesk.com/blockchains-sharedcoin-users-can-identified-says-security-expert/

I dont think the previous version of SharedCoin is ever coming back because its GitHub page is now gone:

https://github.com/blockchain/Sharedcoin


Does bitcoin still concatenate the locking and unlocking script and execute? Does bitcoin still concatenate the locking and unlocking scripts and execute in order to validate transaction or is validation done another way?

Does bitcoin still concatenate the locking and unlocking scripts

No. This bug was fixed many years ago. ScriptSig and ScriptPubkey executed separately, not concatenated to each other


Is the generated Public Key from Private Key Unique in Bitcoin? I am generating public key from my private key. I did in Java script and C#.
but generated public keys are different.
My Code in c# (KeyCore.NET):

PrivateKey pv = new PrivateKey(Globals.ProdDumpKeyVersion, "KwY7eRvXXFd7HPX4Zuv8STZMLsVSe2X22HkU24Av84W1Cb7Rd5Yh");
PublicKey pb = pv.PublicKey;
Console.WriteLine(pb.ToString());

result for C# code is 16w4zZWjWnhfEasJcSbfDQeHJRk1LytPHF5ir1ZS9mtUD5adsdH
and the result for javascript code is 16reZXagkyToongduimD25SEerXwP3MQ4n

I used KeyCore.NET and bitaddress

The base58 number 16w4zZWjWnhfEasJcSbfDQeHJRk1LytPHF5ir1ZS9mtUD5adsdH is a base58Check encoding of the (compressed) public key:

030d4018f164d58e41e0c5fb99eb5ec26b4f21fc8ad0db726d51a7cce60c75df0a

which corresponds toKwY7eRvXXFd7HPX4Zuv8STZMLsVSe2X22HkU24Av84W1Cb7Rd5Yh, and whose address is 16reZXagkyToongduimD25SEerXwP3MQ4n. Note that your private key is actually a bit more than a private key. It is a 38 bytes number which is a base58Check encoding of a number which contains 34 bytes (rather than just 32 for a secret key). There is an additional version byte 0x80 at the beginning which indicates that the private key is to be used for the main bitcoin network (rather than a testing network). There is an additional 0x01 suffix byte at the end (just before the 4 checksum bytes) which indicate that the public key associated with this private key is to be generated in compressed form (33 bytes) rather than uncompressed form (65 bytes). So while it is true that your WIF representation of your secret key leads to a unique address (one corresponding to a compressed key on the main network), the actual 32 bytes secret, can potentially lead to 4 addresses (depending on compression status of the public key and type of network).


Ripple node compensation How does Ripple charge fees for XRP-only transactions to compensate nodes?

I've heard of what I can only describe as a "network fee", that some XRP are burned per transaction.  What is the motivation for that?

I'm also unsure of how the node types are compensated.  There seems to be consensus builders and some kind of set of miners, but I can't be sure.  Are they also compensated through BitCoin type fees?

During normal operations, the "fee" is set to be a small fraction of .01 USD. This is for ALL transactions, regardless of the units being exchanged through the system.

This is a protection measure for the ledger against spam attacks. If there was an attempt to overload the consensus system, the fee would increase in increments. It would still be a very small amount for a normal user and would be a financial hindrance to a spam attack.

There is no monetary compensation for being a part of the consensus. The base fees and load fees are destroyed. Ripples are not mined, it was all created at once. People will likely be running their own servers for fast, secure access to consensus, not coin rewards.

A basic and technical overview of transaction fees and how they escalate to prevent spam
https://ripple.com/wiki/Transaction_Fee

How consensus works.
https://ripple.com/wiki/Consensus
"Finding consensus by trusting validators not to collude is a simple and strong way to establish the valid ledger. Because, the network is not relying on proof work, this consensus process is fast and allows the Ripple network to validate ledgers in seconds."

An excellent visual explanation of consensus. Also shows how transactions can be verified within seconds as opposed to the minutes required for many other crypto-currencies.
http://www.youtube.com/watch?v=pj1QVb1vlC0


Cannot transmit raw bitcoin transaction I'm using the testnet and as far as i can tell im doing everything right but it just wont send.
The coins are old with more than 170 confirms now, the unspent output has a total of 4. I'm sending 3 to another address in my wallet and 0.5 to another address in my wallet with 0.5 as a tx fee.

When I sign it I get a hash and 'Complete:True' at the end but when I send it i get error: {"code":-22,"message":"TX rejected"}.

Here is a copy of the transaction:

{
"txid" : "de46aedbe1a2c494de1ae59f81817828b8e5cc7d9165de88c0912689e497dfeb",
"version" : 1,
"locktime" : 0,
"vin" : [
    {
        "txid" : "7fc9def2f3e52cd6ffaef52f44648c9170fef3e05ccc356a5280fbea447e9f7a",
        "vout" : 0,
        "scriptSig" : {
            "asm" : "3045022100a38d7099f34d80341d4b83ecd5f7869c30d5ab0b494999eb59308a2689e213d902201f8a3405c5444094051780e428f2ce7e94c094537cd137b848907c10264d635901 025446e16d127120ac9be07998024e63d897763ea7b5a9d08bc22790bfbe55b717",
            "hex" : "483045022100a38d7099f34d80341d4b83ecd5f7869c30d5ab0b494999eb59308a2689e213d902201f8a3405c5444094051780e428f2ce7e94c094537cd137b848907c10264d63590121025446e16d127120ac9be07998024e63d897763ea7b5a9d08bc22790bfbe55b717"
        },
        "sequence" : 4294967295
    }
],
"vout" : [
    {
        "value" : 2.00000000,
        "n" : 0,
        "scriptPubKey" : {
            "asm" : "OP_DUP OP_HASH160 95565025383b3a15b44f3aceecb0b720ef25ee47 OP_EQUALVERIFY OP_CHECKSIG",
            "hex" : "76a91495565025383b3a15b44f3aceecb0b720ef25ee4788ac",
            "reqSigs" : 1,
            "type" : "pubkeyhash",
            "addresses" : [
                "mu8aNmqV5ZGVNCrvUCxA64xEKDMEjfxYFe"
            ]
        }
    },
    {
        "value" : 0.50000000,
        "n" : 1,
        "scriptPubKey" : {
            "asm" : "OP_DUP OP_HASH160 40d3392408f0c97de32139b4dead0736e6f2b05d OP_EQUALVERIFY OP_CHECKSIG",
            "hex" : "76a91440d3392408f0c97de32139b4dead0736e6f2b05d88ac",
            "reqSigs" : 1,
            "type" : "pubkeyhash",
            "addresses" : [
                "mmRiaNorzMBgLfCHDar5okg7j1QjYMb526"
            ]
        }
    }
]

}

According to blockexplorer.com your output has a total of 9.9999 (and not 4) btc. If you own both vout addresses for this transaction, using only 2,5 of them in your raw transaction leaves a 7,4999 btc fee for the miners, which is insanely high.

According to bitcoin 0.9 release notes there is a mechanism now in place that:

  Reject insanely high fees by default in 'sendrawtransaction'

so that could be the reason that your transaction is being rejected. Try adding one more vout to your raw transaction and see if it works.


list of addresses for major bitcoin exchanges Is there a list available of the addresses for the aggregating wallets of major bitcoin exchanges? If so, where?

Try searching for largest balances on the blockchain explorers and they sometimes have them labeled. For example: Bitcoin Rich List shows:

3D2oetdNuZUqQHPJmcMDDHYoqkyNVsFk9r
wallet: Bitfinex-coldwallet 179,384 BTC
16ftSEQ4ctQFDtVZiUBusQUjRrGhM3JYwe
wallet: Binance-wallet  158,779 BTC
16rCmCmbuWDhPjWTrpQGaU3EPdZF7MTdUk
wallet: Bittrex-coldwallet  112,203 BTC
3Nxwenay9Z8Lc9JBiywExpnEFiLp6Afp8v
wallet: Bitstamp-coldwallet 101,848 BTC
3Cbq7aT1tY8kMxWLbitaG7yT6bPbKChq64
wallet: Huobi-wallet 98,042 BTC


Electrum multisig 2of2 on separate machines and both offline(cold storage) I am lost sending coins from these Electrum 2of2 multisig wallets. Call them mutisig1 and multisig2. Both wallets have the 2of2 heading, presumably that means they are correctly setup, they were created with their own seeds and then each used the other's seed for multisig.

I use an online watch wallet(using xpub of multisig1 wallet) to create an unsigned send txn, save it to a usb drive.
load unsigned txn into multisig1  , sign it , save and export to usb drive.  (what is the difference between save and export ?)
load signed txn into multisig2. There is no sign option(greyed out) then what ?

I tried 3 methods to send the coins , all 3 different, all 3 worked(confirmed sent), at least 1 was certainly wrong(only 1 sig). Now I'm worried ! I conclude that this does not achieve 2of2 in electrum or I have screwed something up. You can pretty much do anything as long as you have at least 1 sig, it will confirm.

Test1

Online watch wallet-send txn , export to usb
Offline multisig1 wallet-load unsigned txn,  sign, save, export
Offline multisig2 wallet- load unsigned txn, sign, save, export(this overwrites the prev signed txn file from multisig1 wallet )
Load signed txn file from step 3 onto watch wallet and broadcast

Test 2
l
Only signed on 1 multisig wallet and then broadcast from watch wallet. (sent and confirmed only 1 signature !)

Test3

and 2. are the same, but 3. I just loaded the signed txn on multisig2 and then saved and exported it back. Sign button was greyed out.

A watch only version of a multisig wallet must be created using the xpubs of both wallets not just the xpub of one wallet. Now there are two possibilities here:

You created a wallet with one xpub and one seed. This wallet is not watch only and transactions generated by it need only be signed by the wallet whose xpub you used. You can tell if this what you did in two ways. One way is that when you open the wallet there should be no warning dialog that it is a watch-only wallet. The other is that when you attempt to spend your coins the resulting transaction preview dialog should show "partially signed 1/2" up top below the tx id.
You created a single sig watch only wallet with just one of the multisig wallet's xpubs. Transactions created by this wallet can spend bitcoins sent to single sig p2pkh or p2wpkh addresses. You need only sign it with one of the multisig wallets i.e. the one whose xpub you used. You can tell that this is what you did if you get a warning dialog about watch only wallets when you open the wallet and if it says standard for wallet type under wallet menu > information.

In order to create a proper watch only version start by creating a new wallet file via file menu > new/restore, enter a unique filename and click next. Then select multisignature as the wallet type, 2 of 2 as the number of cosigners and signatures required, choose "Use a master key" or "enter a cosigner key" when asked to add a cosigner and then enter the xpub of one of the cosigning wallets. Repeat this last step until you've entered both cosigner's xpubs.


Would backing up my private key be enough? Lets say I put my wallet's private key on a rocket and fire it towards mars.  In 50 years time I travel to mars for a cheap vacation and find my private key.  Would I then have full access to my wallet, including all the transactions over the past 50 years and the current balance (from when I landed on mars in person) etc?

In other words, to fully backup my wallet and be able to restore it with full control, do I only need to backup my private key?

That's exactly how private key works. All you need to have is a private key to access your wallet. And this is the reason it is not a good idea to fire your private key to mars, if someone get there before you, they will steal all your coins.


What prevents someone from tainting the coin tumbling pool of the Wasabi wallet? Wasabi is a new type of wallet with a built in tumbler if I'm correct. What stops someone from tainting the tumbling pool of coins with non-approved coins? I'm weary of using these privacy tools as I don't want my coinbase account frozen just because someone mixed a bad coin in the lot.

There are a number of reasons why this kind of blacklisting is problematic in practice, but take it with a grain of salt, because I'm the creator of Wasabi,  so I am biased.

This Elliptic report identifies 0.65% of all Bitcoin transactions are mixing transactions. This means, if that kind of blacklisting would happen, they would have to blacklist most bitcoins in existence.
The same report states, 50% of DNM users don't use any mixing, but directly send to exchanges (mind blowing, I know) and these are the coins being blacklisted.
From another point of view, Wasabi's anonymity set will be constant 100, and if a coin from it is tainted, would they really blacklist all mixed coins, where every coin has exactly 1% chance of being the tainted one?
The user base of Traditional Bitcoin Mixers is limited to a certain type of user, who is in desperate need of privacy and in order to get it, he is willing to risk losing money. Since coin loss, and other issues are architecturally impossible with Wasabi, our target user is not limited to them, the target user of Wasabi Wallet is everyone, because everyone needs privacy.
If someone is extremely paranoid, he can just spend coins to himself a couple of times before sending it to the desired "legitimate" place. This is what Samourai's Ricochet is doing.
Speaking of legitimacy, zkSNACKs, the company behind Wasabi is a legitimate company. Privacy is not only not a crime, but a fundamental human right and if an entity would blacklist a mix output, they would be looking ahead of legal trouble. If such a thing would ever happen, please notify us.


How get address from pk_script? We have example in the wiki:

[...]
Output 1:
 40 4B 4C 00 00 00 00 00                           - 0.05 BTC (5000000)
 19                                                - pk_script is 25 bytes long

 76 A9 14 1A A0 CD 1C BE  A6 E7 45 8A 7A BA D5 12  - pk_script
 A9 D9 EA 1A FB 22 5E 88  AC
[...]

What is the pk_script? Is it possible to translate it to bitcoin address being offline (not synced with network)? How to do this?

EDIT:

OK, I understand more right now:

 pk_script
 76 (OP_DUP)
 A9 (OP_HASH160)
 14 (Bytes to push)
 1A A0 CD 1C BE  A6 E7 45 8A 7A BA D5 12 A9 D9 EA 1A FB 22 5E (Data to push)
 88 (OP_EQUALVERIFY)
 AC (OP_CHECKSIG)

A I understand I should use b58encode_check on "data to push" to get bitcoin address. I have found python library which implements b58encode_check (https://pypi.python.org/pypi/base58) and did try with it:

for byte in (0x1A, 0xA0, 0xCD, 0x1C, 0xBE,  0xA6, 0xE7, 0x45, 0x8A, 0x7A, 0xBA, 0xD5, 0x12, 0xA9, 0xD9, 0xEA, 0x1A, 0xFB, 0x22, 0x5E):
    buffer += chr(byte)
print b58encode_check(buffer)

But I got 3RoCeq4K8ddPW6ugcheFoXK4GC2Ajo7ZF which don't look like bitcoin address. What I'm doing wrong?

See the wiki. Basically you have to extract the 20 byte pubKeyHash (shown as bytes to push) from the scriptPubKey and convert it to Base58 (which is also described in the wiki.  There is no need to be online to perform this operation.


Why is the transaction fee a multiple of the amount I want to send? I tried sending 0.0001 BTC from my blockchain.info wallet.  It deducted 0.0009 BTC from my account, including a 0.0008 BTC is transaction fee.

Is it correct that the transaction fee is 8 times larger than the amount sent?

That's the recommended fee, the recommended fee is like the minimum amount to get your transaction included in a block ASAP. You should be able to set fees, but for small amounts like that a fee that large is common, remember, miners can only include so many transactions a block every 10 minutes, so they pick the transactions with the largest fee and smallest txn size.


Does ASICBOOST only work on Bitmain miners and how does one enable it on these systems? From what I read ASICBOOST gives you a 30% better hash rate, does this only work on all or certain Bitmain asic miners? And how does one enable this hidden feature in these miners?

"Our ASIC chips, like those of some other manufacturers, have a circuit design that supports ASICBOOST." - Bitmain statement

Bitmain claims that it wasn't used on mainnet. It is currently unknown how to make use of the feature. Likely, you'd need custom firmware and software.

Edit: Here's someone on reddit describing how to activate ASICBOOST: https://www.reddit.com/r/Bitcoin/comments/63yo27/some_circumstantial_evidence_supporting_the_claim/dfy5o65/


If transactions are changed in memory how miners know it? If Alice requests something to bob, then Alice sends her public key and Bob encrypts message by using Alice's key.

Bob uses his private key and hash function to make a signature.
After finishing this procedure, Bob sends encrypted message with signature.

At last, Alice decrypts message and put it in hash function and she compares output with decrypts signature.

This is what I understood about transaction.

But When transaction is waiting in memory If someone changes a content of signature by using bob's public key How miner know it is wrong signature?

To compare message with signature, miner needs Alice's private key. But miner doesn't have.

Is there other way to compare signature with encrypted message?

The process you described is not what happens in Bitcoin. It is loosely what happens with software like PGP which use public-key cryptography to provide various security benefits when sending e-mail messages.

In either case, you don't use a private-key to verify the integrity of the data-content.

In the case of something like PGP, the recipient can use the sender's public-key to determine whether the signature was produced by the corresponding private key from the received message contents.

In the case of Bitcoin, any bitcoin node can verify any transaction in the blockchain using only data in the blockchain. For details of the principles you could read Satoshi Nakamoto's original whitepaper or online resources such as

https://en.bitcoin.it/wiki/Transaction
http://learnmeabitcoin.com/guide/digital_signatures_signing_verifying


Do full nodes store the complete merkle tree or do they regenerate it when creating a merkle proof? I understand what the merkle root is for. And I understand that blocks don't store the merkle tree.
Question 1) Is there any place that the complete merkle trees get stored? I don't mean the merkle root hashes since I know they are in the block headers.
Question 2) Let's say a full node starts proving to a light node that a specific transaction is in Block J. How does the full node send the merkle branch to the light node? Does it loop through the transactions again to get the hashes and then sends the interior node hashes of transactions, or do full nodes already have the complete merkle tree (whole tree and each internal hash) stored somewhere?

Bitcoin Core, in its BIP37 implementation, will compute the Merkle proofs on the fly. It does not store the blocks' Merkle trees anywhere (only its root is stored).


Doubt on lightning channel opening It's 5 days since I opened my first (and unique, for now) lightning channel.
Unfortunately it seems that only me have funded the channel while the counterparty didn't, so the channel it's actually a unidirectional channel.
Indeed the output of the command lightning-cli listchannelsshows direction: 1 (I'm running the c-lightning implementation).
Is it normal that the counterparty doesn't have funded the channel yet after 5 days or I should think I've misconfigured my channel?

Channel funding (and the distribution of funds) is determined at the time of channel opening. Once opened, a party cannot ‘add funds’ to the channel, this would require opening a new channel.

If you opened the channel and did not specify that some number of sats should be pushed to the remote node at the time of opening, then the channel will open with the entirety of the balance on your side. Note that pushing sats to the remote node is equivalent to making a payment to the remote node.

If you send a payment using the channel you opened, you will gain an ~equivalent amount of incoming capacity.

The current BOLT spec does not include multi-party funding, but this feature is planned for future updates to the spec.


Blockstream Green Wallet Security I am trying to understand how secure the green wallet is. I thought of a few scenarios where my funds might be in danger:

If GreenAddress service becomes unavailable, they have a nlocktime transaction that allows me to recover the funds after 90 days. My funds should be accessible after 90 days.

If GreenAddress service gets hacked and it automatically cosigns malicious transactions. My understanding is that I should be able to use the recovery tool (https://github.com/greenaddress/garecovery) to send the coins to a new wallet independent of GreenAddress. Is this right?

I lose access to both my phone and seed phrase.

Are there other possible scenarios that would result in a loss of my funds due to an error on the Green Address side?  How secure really is the green wallet? How much funds should one trust it with? Thanks!!

Part of the design is that compromise of their service is a little bit pointless. They can not sign transactions spending your money to begin with, as the transactions also need a signature from your wallet too.
There’s no scenario in which the service can spend your money without your participation to some degree. In unlikely scenario the service attempts to force you to sign a transaction, you wait for the timeout and spend your money using the backup tool you linked to.
As with any wallet, if you lose both the seed phrase and the wallet on your phone your money is lost, those are the things which identify your money. To avoid this as a problem, don’t allow that to happen.


Total Market Cap Data Set I want to get the data for the total market cap similar to what I see when I view this page in the total market capitalization graph.

https://coinmarketcap.com/charts/

I already have the bitcoin market cap data but are there any publicly available datasets or is there anyway to get it directly from coinmarketcap? I'd like to be able to get as much data as I can.

Have you tried CMC's REST API? https://coinmarketcap.com/api/


Bitcoin RawTransaction Json - what do all the variables mean The below is the response we get. could someone please explain what each element is.

type RawTransaction struct {    Blockhash     string    BlockTS       uint32 json:"blocktime"    Confirmations int    Hex           string    Locktime      int    TXTS          uint32 json:"time"    TXID          string    Version       int    Vin           []struct {        ScriptSig struct {            Asm string            Hex string        }        Seqeuence int64        TXID      string        Vout      int    }    Vout []struct {        N            int        ScriptPubKey struct {            Addresses []string            Asm       string            Hex       string            ReqSigs   int            Type      string        }        Value Amount    } }

the transaction has inputs and outputs. the inputs describe the previous bitcoins being spent in this transaction and the outputs describe the address(es) to send these bitcoins to. you can view transactions for any block using blockexplorer.com. for example, here is the simplified data for block 728, and here is the data for this same block converted from the blockchain into json format.

for a good explanation of what each of these elements inside the transaction means, i recommend this article.


Which alternative currencies might experience a sharp rise in popularity like bitcoin recently did? Simple question for newbies. Which other alternative currencies (crypto and others) are possible candidates for a surge in popularity?

Is there any reason that bitcoin will always dominate the alt currencies or is it just one of many contenders waiting to be discovered by the masses any day now?

there is no real way to predict where the market goes. Therefore it is a question without an answer.

The part about bitcoin surge is just a question of supply and demand. bitcoin doesn't really have a value. the value lies in the demand from people hoarding or spending them and the supply from miners and/or brokers. It is now in high demand so it's high in price.If by popularity you mean a hyper deflation. Well then yes. bitcoin will probably always dominate the others.


How do miners avoid transactions getting dropped? I'm having a problem figuring out how miners solve the following problem:

Let's say we have 2 miners: M1, M2.

M1 adds transactions A,B,C,D to their block. M2 adds transactions A,B,C to their block. For some reason, transaction D will come to M2 a few seconds after M1 received it.

Now, M2 solves the block and sends this block to everyone. Consequently, M1 throws their block away and starts working on new block.

Next, M1 adds transactions E,F,G to their block, whereas M2 adds D,E,F,G (M2 gets D now) to their block. Now, M1 solves the block first and broadcasts it. Therefore, M2 throws their block away and starts a new one.

In this case, transaction D won't get in any block! (The problem is caused by network speed which caused the fact that D arrived at M2 a few seconds after it got to M1.)

So, how is this problem handled or avoided?

Miners have mempools where they store all transactions they consider to include in future blocks. They don't put transactions they received into their blocks, right away.

But they don't put them into their mempool right away, either. The transactions in each miner's mempool are valid and worth the miner's effort (pay at least a certain amount of fee).

They can't even include all of the transactions they know about in their blocks, at the moment. Blocks can at most be 1 MB in size and because there currently are many transactions, the mempools of miners are much bigger than 1 MB.

At point 0 in time, the mempools look like this:

mem_M1 = {A, B, C, D}
mem_M2 = {A, B, C}

When M2 solves the block, they remove all transactions they included in their block from their mempool:

mem_M1 = {A, B, C, D}
mem_M2 = {}

M2 then sends the block to M1 who validates the newly received block. If M1 considers the block valid, they remove all transactions in that block from their mempool:

mem_M1 = {D}
mem_M2 = {}

Note that D is still in there. M1 doesn't flush their mempool. Only the transactions included in the newly received blocks have been removed.

They then receive more transactions:

mem_M1 = {D, E, F, G}
mem_M2 = {D, E, F, G}

Next, M1 solves a block and removes the transactions they included from their mempool:

mem_M1 = {}
mem_M2 = {D, E, F, G}

After M1 sends their newly mined block to M2, M2 removes all transactions included in that block from their mempool:

mem_M1 = {}
mem_M2 = {}

All transactions have been included in blocks.


What is the meaning of "service bits" in Bitcoin? // Note that of those which support the service bits prefix, most only support a subset of
// possible options.
// This is fine at runtime as we'll fall back to using them as a oneshot if they don't support the
// service bits we want, but we should get them updated to support all service bits wanted by any
// release ASAP to avoid it where possible.

Reference: https://github.com/bitcoin/bitcoin/blob/master/src/chainparams.cpp#L116

The service bits are a field in the version method which indicate what services a node supports. These services are features that a node supports and tells other nodes which connect to it what it may or may not be able to request from the node. They also indicate what that node can receive.

For example, if a node has the NODE_SEGWIT service bit set, then when another node connects to it and they see NODE_SEGWIT, they know that they can send segwit blocks and transactions to that node, and can expect to receive segwit blocks and transactions from that node. If they did not see NODE_SEGWIT, then they would know to strip segwit blocks and transactions of their witnesses before sending the transaction to that node.


Using ATI and Nvidia Cards together I want to mine Litecoin on an ATI 7950 while being able to play on my GTX 680.

Is this possible ? If yes then how ?

Your issue is trying to run ATI and Nvidia video drivers at the same time.

Many people mine on Linux LiveUSB.

This would be different if
a second GPU was so that you could get both of them to mine litecoin at the same time.In that case you would want your GTX680 not only mine but also display, where your other ATI card would do nothing but mining.

This I haven't tried personally but people have using plug and play

The system begins with the graphic card in the PCI-E closest to the CPU, all drivers were installed for Nvidia first

Put 7950 in the machine

Windows will ask to restart the system, I guess to figure out that it's had a hardware change, so restart

Install AMD drivers

For Windows to see the card, plug it into another monitor. Another way is too use a dummy plug: http://www.overclock.net/t/384733/the-30-second-dummy-plug


Which bitcoin wallets let you export to a universal .wallet format? Which bitcoin wallet applications for android, windows, and mac allow you to export .wallet files that are cross-compatible with each other? Currently there are so many wallet applications out there and I just want to use as few as possible that give a sense of security if one day the app developer just stops developing for their app.

Thin Clients (SPV)

MultiBit.org

Tools -> Export Private Keys -> Open the file you exported

grabHive.com (Mac only)

Export not yet implemented

Browser Add-ons

SpareCoins.io (Chrome)

Wrench icon -> Backup Wallet (encrypted)

Full Clients

Bitcoin-Qt

Help -> Debug window -> Console

walletpassphrase {passphrase} {timeout}
dumpwallet {filename} (Recommended method, dumps all wallet keys in a human-readble format, into a file named filename)
dumpprivkey {bitcoinaddress} (Optional method, exports a private key)

Clients with Deterministic Wallets

BitcoinArmory.com

Wallet Properties -> Backup Individual Keys -> Private Key (Plain Base58)

Electrum.org

Export -> Private Keys -> Open the file you exported

Hybrid Web Wallets

StrongCoin.com

Your Accounts -> Select one -> Decode Private Key (with passphrase)

BlockChain.info

Import/Export -> Export Unencrypted -> Look for 5*, L* or K* Private Keys

Android Wallets

Mycelium.com

Keys -> (Options bar |) -> Export
(OUT OF DATE) Key Management -> (Options) -> Export to SD card(jpg to "mycelium-export" folder), QR code or to the clipboard

BitcoinSpinner

(Options) -> Settings -> Advanced -> Export private key -> QR code or clipboard

Bitcoin Wallet (by Andreas Schildbach)

(Options) -> Back up Keys (encrypted)

openssl enc -d -aes-256-cbc -a -in

  .... there will be more in time, hope to keep this answer updated


Maximum number of inputs per transaction In theory, what is the maximum number of inputs per transaction? Is it defined primarily by the maximum number we can store on the 9 byte varint?

How big of a number can be stored on 9 bytes?

Would such a transaction even fit in a block if it had just 1 output?

No, the number that can be represented by the varint has no effect on the maximum number of inputs. That number is far too large. Rather the maximum number of inputs is constrained by the block size.
If it really matters to you what the maximum number that a varint can represent is, it's just the maximum value for a 64-bit integer. That's 0xffffffffffffffff. There's really no constraints on what a varint can represent. A transaction with such a number of inputs would not fit in a block, nor would it fit on any existing single storage medium as that transaction would be at least 664.1 Exabytes in size.
The maximum number of inputs that can fit in a valid transaction is 24386.
Such a transaction would not use segwit, so we use the maximum block size without segwit of 1000000 bytes. Subtract the 146 for the header and coinbase transaction to get 999854 bytes for the transaction. Subtract 4 bytes for the version, 4 bytes for the locktime, 1 byte for output count, 8 bytes for output value, 1 byte for output script, and 3 bytes for input count. This leaves us with 999833 bytes. With 41 bytes per input (32 previous txid, 4 output index, and 1 for script length, 4 for sequence number), there can be 24386 inputs.


USB miner and risk of fire I wanted to try-out mining from a pool from a raspberry pi. I ended up buying a USB ASIC miner (not sure I can post brand here). It's a bit bigger than a USB drive and mounted with heat sinks and fan. It is connected to a USB hub which is powered separately. I think it draws about 10 watts ( 5v x 2A)
My question is, if I let it turned on all the time, does it have a risk of fire? The electricity in my house is reliable (wires are safe), but I'm concerned about the heat. Or any other risk it starts a fire while I'm sleeping (for now I'm not letting it on when I leave the house).
Am I being paranoid? Any particular recommendation?

Just in case someone is wondering the same, mining from a small 10W USB ASIC miner is not really a fire hazard if you take proper precautions:

let air flow around the device
don't place it near easily flammable material

But as I have experienced, I was on average 5 MH/s which is not going to get me very far.


Problems accessing BTCE api after certificate change? I used to have a bot that interacted with the btce api through java/netbeans, and then after the MtGox fiasco I shut it down for a while. Now I am trying to start it back up, but while bitstamp and cbx are working fine, my btce exchange interface is broken. I am getting a "PKIK path building failed, unable to find valid certification path". Given that btce changed their certificate recently, it seems that this certificate change must be related to the problem.

I have done some research and evidently this means that I need to add the new btce certificate to my trust store in java. After some further research, I understand that this involves adding a cetificate file to my cacerts keystore in myc:/program files/java/jre8/lib/security directory. I have tried doing it manually through firefox to a cer file,  and putting it inside program files (x86)/java/jre8/bin and installing it through the command line using the following commands inside the same /java/jre8/bin directory:

$set KEYTOOL_PASS = 'changeit'
$keytool -import trustcacerts -keystore ../lib/security/cacerts -storepass %KEYTOOL_PASS% -noprompt -alias 'BTCE' -file btce.cer

But this did not work either. I talked to a friend who told me that perhaps I not only need to add the btce certificate, but also the godaddy G2 certificates on which it depends. So I exported those from firefox and added them to my keystore as well. But still I am getting the same "PKIK path building failed" error when I try to run my program in netbeans.

I cannot figure out what to do from here. My friend who is a server-side programmer is out of ideas, and I have tried every linux command I can find by googling this issue. And BTC-E.com says that they do not offer programming support, and said, I quote, "there is nothing we can do to help". so I am now turning to bc stack exchange. I would appreciate your help!

Best,

Paul

I have got two JREs in my windows 7 machine. I have executed both below listed commands and I am able to connect it btce.

keytool -import -keystore "C:/Program Files/Java/jdk1.8.0_05/jre/lib/security/cacerts" -storepass "changeit" -noprompt -alias "BTCE" -file C:/Users/Dell/Downloads/btceSERVER.cert

keytool -import -keystore "C:/Program Files/Java/jre8/lib/security/cacerts" -storepass "changeit" -noprompt -alias "BTCE" -file C:/Users/Dell/Downloads/btceSERVER.cert

Points to note:

I have mentioned full path for the keystore
I have not used trustcacerts

Awaiting response

Two ways I can think of to download certificate.
First(using linux):
echo -n | openssl s_client -connect btc-e.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > /tmp/btceSERVERNAME.cert

Second(using firefox):
1. Visit h t t p s:/ / btc-e.com/
2. Click on the small Lock icon present in front of https in the url section. This will bring up a small popup
3. Click "More information" button, this will bring up a popup window titled as "Page info",
4. Click "View certificate", this will bring up certificate viewer
5. In certificate viewer, select "Details" tab
6. Click export button, which will bring up file save dialogue to save the cert.


Does block size effect Miner's Hashing speed? From my last question:
Bitcoin Block Size - What are the rules?

I learned that the block size can vary from a few kB up to a MB. This leads to my next question:

Does the block size effect a miner's hashing speed? (i.e does a very large block decrease hashing speed?)
If so, what are the details of that relationship?

Only block header gets hashed, and it has fixed size, so the total block size doesn't matter.

From Wiki:Block hashing algorithm

  The body of the block contains the transactions. These are hashed only
  indirectly through the Merkle root. Because transactions aren't hashed
  directly, hashing a block with 1 transaction takes exactly the same
  amount of effort as hashing a block with 10,000 transactions.


Altcoin peers do not sync with each other I created two altcoin peers and they can add blocks to genesis block. However their blockchains do not sync with each other!

The only way let the block merge is to stop a peer and restart the peer.

Is there any solution? Thanks..

Solution found!
Bitcoin client use checkpoints to prevent 51% attack. What are checkpoints?

Modifying checkpoints in chainparams.cpp solve this sync problem.


How is it possible to say that a bitcoin was fully spent? Is a simple question, but I want to understand this at the low level.

Since the UTXO is a database with the yet-to-be-spent coins, how can I say that a given coin was already full spent? What would be a "half"-spent coin (if this is even possible)?

An output ("coin") is by definition either fully unspent or completely spent. There is nothing in between. A transaction has one or more inputs (which refer to the unspent outputs of earlier transaction) and it fully consumes them.

A transaction can also have 1 or more outputs. For each output a value is specified (number of Satoshis), so by being a little creative you can easily split or merge "coins".

This way Bitcoin "simply" needs to remember only the last outputs of a chain of transactions, there is no point in remembering (indexing) anything older. That's what the UTXO set is: Unspent Transaction Outputs database.


How many nodes have to confirm a transaction for it to go to a mempool? Or is it somehow based on hashing power? I am trying to understand chronologically what happens to a transaction from the second it is sent to the moment it is added to a block.

None. The mempool is composed by unconfirmed transactions.

If you send a valid transaction to other nodes, the first node that receives can be a miner, then it puts on his/her mempool. Or it can send it to other nodes unit it eventually reaches a miner. There's no limit for how many nodes relay it.


Convert an lower-cased address to a properly capitalized address? Is it possible to take a lower-cased address like 1dice8emzmqkvrge4qc9buff9px3xaydp and convert it to the properly capitalized address of 1dice8EMZmqKvrGE4Qc9bUFf9PX3xaYDp ?

I've looked around and everything can simply tell me whether it is valid or not.  And without the correct capitalization, the address is of course not valid.

See the related question Can you help me fix this address?.

It should be pretty easy to adapt the code I gave in my answer to try upper and lower case for each letter in the address, and for each possibility, see if its checksum validates.  The address you gave has 28 alphabetical characters, so there are 2^28 addresses to check, which is not too unreasonable.

I would not expect there to be any way that's substantially better than this brute-force approach.  Since the output of a good cryptographic hash function should look random, there shouldn't be any "patterns" in the upper/lower case distribution for us to take advantage of.

There is a chance that more than one possibility results in a valid address.  In that case, there would be no way to know which of them was the address that was actually intended (but if only one of them has appeared on the block chain, that should settle it.)


Wallet not updating with balance and database error I'm fairly new to using bitcoins and have been having some trouble with my wallet. I bought bitcoins on coinbase and transferred them to my bitcoin core wallet. The transaction was confirmed with 616 confirmations, but it has been several days and the balance has not shown up in my wallet. At the time, the wallet was was synchronizing with the network for what must have been a total of 24+ hours and was less than half way there. Last night, before it was done synchronizing, I got a database error and now it's "Reindexing blocks on disk" and is 3 years behind. Are my bitcoins lost or will they be visible in my wallet once my wallet is done reindexing?

They should be there when you are done synchronizing. I would just wait for bitcoinqt to finish syncing if you are not in a rush.

As noted by this post you can do a workaround to access your coins now if needed:
My client stopped synchronizing, how can I access my wallet?


Lessons from the Mt. Gox Hack - 850,000 Bitcoins Stolen Mt. Gox was a bitcoin exchange based in Shibuya, Tokyo, Japan.
Launched in July 2010, by 2013 and into 2014 it was handling over 70%
of all bitcoin (BTC) transactions worldwide, as the largest bitcoin
intermediary and the world's leading bitcoin exchange.

Mt. Gox announced that approximately 850,000 bitcoins belonging to
customers and the company were missing and likely stolen, an amount
valued at more than $450 million at the time

Today that amount of Bitcoin would be worth nearly $40 billion dollars (depending on the day of the week).
Reading the above makes me concerned. If the world's (once) largest exchange was unable to prevent a hack of this magnitude, how can any exchange (without a multi million dollar security budget) be reasonably certain that hack like this won't effect them?
Is there a consensus (or at least a plausible theory) as to what went wrong on the technical side that allowed such a large exchange to be hacked? What practical lessons can one learn from this story in terms of securing their users funds?

Is there a consensus (or at least a plausible theory) as to what went wrong on the technical side that allowed such a large exchange to be hacked?

Independent Investigation related to Mt. Gox by Kim Nilsson: https://youtu.be/l70iRcSxqzo (Breaking Bitcoin Conference 2017)
Summary of the presentation:

There were multiple thefts since 2011

Mt. Gox was insolvent for most of it's existence

Traded it's own liabilities on Mt. Gox exchange

Connected to other bitcoin thefts

Alexander Vinnik arrested in 2017, received over half a million bitcoin from Mt. Gox and other bitcoin thefts, deposted bitcoin to BTC-e, TradeHill, Mt. Gox and alleged by US to be a BTC-e administrator

He didn't use any bitcoin mixers, did UTXO consolidation few times, deposited bitcoin back to Mt. Gox and Used his real name online to complain about his stolen funds being confiscated

All evidence pointing to Vinnik are for the wallets that receive and move the stolen bitcoin. The thief had possession of Mt Gox's private keys, could have sent bitcoin anywhere. Unlikely a single person carried out these many thefts.

Private keys were most likely stolen. Running a second bitcoin wallet on top of a copied wallet.dat file leaves blockchain fingerprint. 100 private keys are pre generated in Bitcoin Core wallet using keypool.

First 100 theft transactions have change addresses perfectly matching Mt Gox's keypool as of September 11, 2011

Some of those addresses were allocated as deposit address on Mt Gox

Thief steals bitcoin and Mt. Gox identifies change as deposit.

Things hacked in 2011: Hot wallet with upto 100,000 keys

Theft pattern: Each transaction steals similar amounts, longer and longer time between transactions and restarts with same stolen wallet.dat file.

Incidents: Liberty Reserve Withdrawal Exploit 2011 (XML injection), Liberty Reserve Withdrawal Exploit #2 2011 (negative amount used for withdrawal resulted in deposit), Hot wallet stolen in 2011 (80,000 BTC), Public hack via compromised accounts in June 2011 (2000 BTC), Compromised database in September 2011 (77,500 BTC), Hot wallet stolen again (Sep-Oct 2011) involving 630,000 BTC, Incorrectly detected deposits (30,000 BTC), Accidentally destroyed bitcoin due to bug in new bitcoin wallet(2609 BTC), Willy (28,000 BTC)

What practical lessons can one learn from this story in terms of securing their users funds?

Exchanges should hire competent developers to manage funds and use multisig which many already do right now

Use latest bitcoin technologies and follow best practices

Keep most of the funds in cold storage, some amount in hot wallets to manage deposit and withdrawals.

Do not trade with users funds and be transparent about everything

Users should avoid centralized KYC exchanges and use DEX or trust minimized exchanges like Bisq, HodlHodl, Localcryptos, Sovryn, OpenDEX, TDEX etc.

Developers should focus on better key management, trust minimized exchanges and layer 2

Developers should improve privacy in Bitcoin and Users should follow the best practices like : No KYC, No address reuse, Coinjoin, Payjoin, Full node, Do not share information about transactions on social media etc.


Import private key to bitcoind I have a bitcoin testnet account in copay wallet. I want to import its private key in bitcoind. So, I exported the private key, but they were encrypted. I got a

  Test-Copaybackup.aes.json

file. Therefore, I can't use importwallet rpc in bitcoin-cli, since it requires an unlocked wallet or an unencrypted wallet. What else I do?

The encrypted JSON file likely contains individual private keys, or seed bytes. The first step would be to actually decrypt it, which can be done via openssl:

openssl aes-256-cbc -d -a -in Test-Copaybackup.aes.json -out wallet.txt

Once you have that, looking at the decrypted file should tell you what kind of data you're working with. If you see regular private keys, just import them normally. If you see a mnemonic seed or something similar, you'll need to convert it to keys.


Changing a private key of a public Bitcoin address I would like a way to change the private key of a public address, for this you'd of course require the current private key.
Is this at all possible?

I want to prove that it can be done, or prove that it cannot be done.

It cannot be done.

Every private key has exactly one public key, and every public key has exactly one address (ignoring compressed/uncompressed or normal vs P2SH address, which do not matter here).


Are unspent UTXO's on Bitcoin from before the AUG 2017 BCH fork at risk to a replay attack? Is it true that any UTXO's that are unspent prefork of BCH AUG 2017, has a risk of a replay attack? Say I have 1 BTC in my wallet which has never moved since 2016. Now I load that private key into BCH wallet and now I have 1 BCH. I make a transaction on BCH to a vendor, but now he takes that same transaction and broadcasts it on BTC chain. Now I lost my BTC too. Is this correct?

No, BCH and BTC transactions were never replayable to the other network.  Starting with the very first BCH block, all BCH transactions were required to use a different SIGHASH_FORKID than used in BTC. This mandatory replay-protection causes BCH transactions to appear invalid to BTC clients, and vice versa, BTC transactions to appear invalid to BCH clients. However, (pre-segwit) addresses remained compatible between the two network, which caused some user confusion.
I assume that the fact that the replay protection was always mandatory may have been lost on some observers, because BCH's replay protection was only made mandatory a couple days before BCH forked off, so a lot of the prior discussion and worries became obsolete last minute. Alternatively, the source of this worry may have been confused by BSV forking off from BCH without any replay-protection whatsoever.


How can I generate an address with some string on it, which will check as correct? How can I generate an address with some string on it, which will check as correct? I don't want to necessarily have the private key for that address, but I want to be able to send money to it.

Note that while your question is interesting as a learning exercise, writing messages into the blockchain in this way is not recommended as you are increasing the UTXO set. You are encouraged to use 'OP_RETURN' instead. There is a thread to which your question is related, but it does not seem to focus on the aim of creating an address with a specific message in it.

A bitcoin address (of type 'P2PKH', i.e. 'pay to public key hash') is simply a 25 bytes number, where the leading byte is 0x00 and the last four bytes (low order bytes) constitute some checksum which guarantees the address has no 'typing' error. Specifically, the last four bytes of the address are the first four bytes of the hash (specifically the double Sha256 hash) of the first 21 bytes (highest order) of the address. So in big-endian representation, a bitcoin address looks as follows:

address (25 bytes) = [0x00][20 bytes][checksum (4 bytes)]

As it turns out, since you are not concerned about recovering any fund sent to your address, you have complete freedom on how to choose the 20 bytes (normally those 20 bytes would be some hash of a valid public key). The only constraints you have are the leading byte 0x00 and the last 4 bytes which will depend on how you chose the 20 bytes.

Now suppose you wish to send the message "HelloWorldHowAreYouIamOk".

One naive approach consists in focusing on the number 1HeLLoWorLdHowAreYouiAmok111 (expressed in base 58) which is of length 21 bytes with a leading 0x00 byte, calculate the hash (double Sha256) of these 21 bytes, keep the first 4 bytes of the hash and append these 4 bytes to the 21 bytes. However, the operation of appending 4 bytes to the right means you are effectively multiplying your 21 bytes number by 256^4 and then add the 4 bytes number. This will completely mess up the Base58 digits of your initial number.

So what you need to do instead is focus on the number 1HeLLoWorLdHowAreYouiAmok111111111 (expressed in Base58, add enough padding so your number is 25 bytes), keep the high order 21 bytes of this number, compute the double hash of these 21 bytes and append the first 4 bytes of the hash to the 21 bytes. In our example, we obtain 1HeLLoWorLdHowAreYouiAmojzzzzu7udH.

As you can see, this is not quite what we were hoping, as the 'k' Base58 digit of 'iAmok' has been replaced by 'j', due to the interference of the last 4 bytes. We should have chosen a shorter message.

I attach some java code to illustrate the procedure:

import org.bitcoinj.core.Base58;
import org.bitcoinj.core.Sha256Hash;
import org.bitcoinj.params.MainNetParams;
import org.bitcoinj.core.NetworkParameters;
import org.bitcoinj.core.Address;

class Test {
  public static void main(String[] args)
  {

    NetworkParameters main = MainNetParams.get(); // main bitcoin network

    // alphabet is "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";

    // This is where we decide what we want to say. The base 58 alphabet
    // does not allow us to use 'l', 'I', 'O' or '0' but that's fine.
    // We are trying to obtain a number which is 25 bytes long with a leading
    // byte of 0x00. So we probably need to start with a leading '1', and
    // we need to add some padding to the right.

    String target="1HeLLoWorLdHowAreYouiAmok111111111";

    // Let us express this number as an array of bytes (big-endian)
    byte[] bytes25 = Base58.decode(target);

    // let us check our number has the correct size
    System.out.println("Size = " + bytes25.length);  // 25 , good

    // let us check the leading byte is indeed 0x00
    System.out.println("bytes25[0] = " + bytes25[0]); // yes it is !

    // retrieving the first 21 bytes
    byte[] bytes21 = new byte[21];
    System.arraycopy(bytes25, 0, bytes21, 0, 21);

    // Let us get the double Sha256 hash of these 21 bytes
    byte[] hash = Sha256Hash.hashTwice(bytes21);

    // Let us create the bytes of the address
    byte[] addr = new byte[25];

    // copying first 21 bytes to address
    System.arraycopy(bytes21, 0, addr, 0, 21);

    // appending first 4 bytes of hash to address
    System.arraycopy(hash, 0, addr, 21, 4);

    // encoding this 25 bytes address in Base 58
    String strAddr = Base58.encode(addr);

    // Address = "1HeLLoWorLdHowAreYouiAmojzzzzu7udH" , almost perfect !
    System.out.println("Address = " + strAddr);

    // let us check address is a valid bitcoin address
    Address address = Address.fromBase58(main, strAddr);  // no errors, good

  }
}


How to calculate low/medium/high fee transaction fee? I have a website where the users can send and withdraw funds using Bitcoin, I'd like to give them the chance of set their own custom fee (Low, medium and high) instead of the site to choose a fixed fee or than allow bitcoind to choose it..

For it, after read and investigate, I've seen that bitcoind have a json-rpc call with the name of ''estimatefee'' which allow us to calculate in real time the fee for the transaction appears on the specified blocks.

I guess that for a high it should be checking the fee in the next 2 blocks, for a normal fee in the next 12 blocks and for a low fee in the next 25 blocks, I've saved the obtained results and I Have comparate them with the data provided by Blockcypher's API: curl https://api.blockcypher.com/v1/btc/main , which it give us a higher fee on the low priority than in the medium, this is weird for me, but except that the rest of the data provided are quite inferior to those that I Have obtained, which makes me think that maybe I am making the calculation of an incorrect way (as all the fees I have obtained are at least the double than the one provided by Blockcypher).

And here is the data obtained from bitcoind:

bitcoin-cli estimatefee 25
0.00198478

bitcoin-cli estimatefee 12
0.00265746

bitcoin-cli estimatefee 2
0.00352903

And here is the data from Blockcypher:

"high_fee_per_kb": 174625,
"medium_fee_per_kb": 83628,
"low_fee_per_kb": 90769,

I haven't found many information related with this, if someone could help me, I would be grateful.

Thanks in advance

Here is a post The Challenges of Bitcoin Transaction Fee Estimation discussing the determination of Bitcoin fees.


Transfer wallet from Armory to Bitcoin-Qt I have a wallet with Armory which I'm not happy with and I'd like to manage my wallet with Bitcoin Core. Is there way to "transfer" the wallet between the clients? I'm currently running OSX 10.11.1.

You can't transfer the wallet, per se, but you can transfer the private keys. Here's how to do it:

Run armory in offline mode (simply run armory --offline)
Click on your wallet and click "Backup This Wallet" and enter the password.
Select "Export Key Lists" and click the button at the bottom
Check "Private Key (Plain Base58)" from the checklist and nothing else.
Select "Omit spaces in key data", as these may cause an "Invalid private key encoding" during import
Take each private key listed in the window and import them into bitcoin by using this command: bitcoin-cli importprivkey <privkey>

Just out of curiosity, what aren't you happy about with Armory? I ask because I'm an Armory developer.


How do I protect my paper wallet from use by a different human who has used a random generator? Since millions of people use Bitcoin and Bitcoin Wallets that use their own addresses use several addresses per day, it is obvious that generators can generate the same characters for the Bitcoin address multiple times. So please therefore simply tell me how one would prevent others from accessing or spending the coins that are stored at my paper bitcoin address.

"Improbable" is an understatement.

There are 2256 possible keys.  In the entire universe, there are estimated to be "only" 2100 atoms.

So the odds of someone else ending up with the exact same address/key as you is far, far less than the same atom, out of the entire universe, being randomly picked twice.

If you are worried about an address collision, here are things that should be more worrisome:

Gamma ray burst wiping out all life on earth.
Sun unexpectedly going Supernova
Rogue Blackhole swallowing the solar system
An asteroid hitting the earth at the same time as nuclear war breaks out.

On the list of things to worry about, an address collision just does not show up.

You say that "millions of people use Bitcoin and Bitcoin Wallets that use their own addresses use several addresses per day".

  100 Million of people
  100 addresses per day
  365 days / year
* 200 years
-------------
Less than 1 Billion addresses used in the foreseeable future.

1 billion is about 230.
Which means that in 200 years, the chance of a collision is somewhere around 1 in 2256-30 or, 1 in 2226, which is still way more than atoms in the universe.

You're easily safe for at least 200 years.


Redirected from a real exchange site to a fraudulent site? I was attempting to reset my authenticator through the real binance site and somehow I got redirected to binancezh.cc which was immediately alarming to me when I noticed; however, upon further investigation, one of the links that led to binancezh.cc was in an automated email sent from binance.com.
How could I have been redirected to a fraudulent site from an interaction that I initiated on the real site?

Edit: It appears that the site is somehow legit but not intended for public use
https://www.reddit.com/r/binance/comments/krt1he/binancezhcc/gif9ca0?utm_source=share&utm_medium=web2x&context=3

If it's a fraud, how could they have sent a fraudulent link through a real binance email address?

It has long been trivial to forge the "from" address in Internet e-mail. You could learn how to do it in about thirty seconds.
See https://en.wikipedia.org/wiki/Email_spoofing

The core email protocols do not have any mechanism for authentication, making it common for spam and phishing emails to use such spoofing to mislead or even prank the recipient about the origin of the message.

The link above goes on to describe countermeasures - but note these are not universally applied.


If I have made a BTC transaction after the fork and haven't claimed my BCH before, have I lost them? The title sums it up pretty well, I made a transaction with bitcoin core wallet after the fork, but I hadn't claimed those bitcoin cash, can I claim them, or have I lost them?

Thanks!

Bitcoin Cash is an altcoin; things that you do on Bitcoin Cash will not effect your Bitcoin and vice versa.

With Bitcoin Core, you can install it's Bitcoin Cash analogue, Bitcoin ABC. From there you import your Bitcoin Core wallet into Bitcoin ABC by copying it to the Bitcoin ABC datadir. Then you can spend your Bitcoin Cash normally.


Manage / run commands in a NXT (nxtcoin) client/server via the command line in Linux? I have nxt (nxtcoin) server installed, but since its built completely different from Bitcoin and uses Java. How do you use the command line to control a NXT client to send, generate addresses, etc?

I want to use this for interfacing with a PHP cms system (drupal) and curious how to interface with the NXT system.

I'm trying to figure this out too.

Instead of running the server interface at http://127.0.0.1:7876 try http://127.0.0.1:7876/test . Looks like a bunch of API calls. I'm playing with it right now.


I need to recover BCH So I had some BTC in a Multibit HD wallet (from 2014) and in October 2017 I transferred it to an Electrum wallet as I had learned that MultibitHD was no longer being supported. I just learned about BCH, and was wondering if there was some way I could gain access to the BCH. Unfortunately, I do not know the seed phrase for my now-empty multibit HD wallet, but I do have everything for the Electrum wallet.

UPDATE: I think I found the seed phrase for the MultibitHD wallet!

To recover your bitcoin cash, you need the access to the private keys of the wallet where your bitcoins were before the fork, which happened at the beginning of August 2017.

If you have withdrawn your bitcoins from your Multibit wallet in October 2017, then you can recover bitcoin cash from your Multibit wallet only. If you have no access to your Multibit wallet anymore, then your bitcoin cash coins are lost. I am sorry.

Update:

In case you still have access to your MB seed, I would recommend you the following simple steps:

Follow this video tutorial to import your MB HD seed into Electrum. Check if there are still any bitcoins on that wallet and withdraw them to another bitcoin wallet. Just to be sure that you won't lose them during the further process. This will not affect your BCH
Follow the official Electrum Recommendation on how to redeem Bitcoin Cash. Short version below:

  2.1 Install Electron Cash.

  2.2 Import your MB seed into Electron Cash.

  2.3 Enjoy your coins and send your promised bitcoin cash reward to :) 3AxGUDoXKtz4w6fba6HPrp8j8XFmSwFCoE

Note1: For a more safer approach, read the recommendation.

Note2: In case you will not be able to import your MB HD seed into Electron Cash, first export another seed or private key from your Electrum wallet, which you created in step 1 and use it instead of the MB HD seed.


Can you include a signature in a bitcoin payment? I know you can use the bitcoin client to sign messages (for which you own the private key) and verify messages from other public addresses. But can you actually embed a signed message into a transaction so its on the blockchain for anyone to verify? When I say "signed message" i'm referring to an arbitrary message like in the attached example.

No. This is not possible, although, technically it could be possible by adding n child transaction each formed as a tx out of you original transaction. The child transaction then could each have a OP_RETURN (data only) output. With a OP_RETURN output you can store up to 80 bytes (mind 5286). A DER signature will be around 72 Bytes (71.5 in avg)

... so not much to left besides the signature (~8 bytes per OP_RETURN tx as tx out of the original tx). So maybe use OP_RETURN txout 0 to n-1 for the text/data and n for the signature. Obviously this will increase your transaction fee a little because you need at least 2 additional transactions.

Conclusion:
Not possible unless your are happy to experiment with forging your own custom transactions.


Unable to make Bitcoind commands I am attempting to make Bitcoin-RPC commands in the Windows 10 terminal using Bitcoind from the Bitcoin Core. However, whenever I start C:\Program Files\Bitcoin\daemon>bitcoind the terminal hangs and doesn't print anything. I've waited several hours and the terminal keeps loading and doesn't allow any input. I've also tried typing C:\Program Files\Bitcoin\daemon>bitcoind -daemon but -daemon is not valid Windows command.

I've also tried querying Bitcoin-cli with C:\Program Files\Bitcoin\daemon>bitcoin-cli getinfo but I get the error:

C:\Program Files\Bitcoin\daemon>bitcoin-cli getinfo
error: couldn't connect to server: EOF reached (code 1)
(make sure server is running and you are connecting to the correct RPC port)

So, after researching and reading other Stack Overflow questions I decided to check my bitcoin.conf file. I didn't have one, so I created one and placed it in the C:\Users\User\AppData\Roaming\Bitcoin directory. My bitcoin.conf file looks like:

rpcuser=user
rpcpassword=pass
rpcallowip=127.0.0.1
rpcport=8332
rpcthreads=10
server=1

But i'm still getting the same errors. Does anyone have any idea on what i'm doing wrong?

Update:

I typed in tasklist into the windows terminal and bitcoind.exe and Clientcore were running. Then I typed :C:\Program Files\Bitcoin\daemon>bitcoin-cli -rpcuser=user -rpcpassword=pass -rpc
port=8332 getinfo, but got another error:

error code: -28
error message:
Verifying blocks...

Update:

I tried C:\Program Files\Bitcoin\daemon>bitcoin-cli -rpcuser=user -rpcpassword=pass -rpc
port=8332 getinfo again a couple minutes later and it worked.

I opened one terminal and ran bitcoind, and another terminal I make the getinfo command and everything works

try this:

bitcoin-cli -rpcuser=user -rpcpassword=pass -rpcport=8332 getinfo

also make sure bitcoind is running, you can do that by
ps -aux | grep bitcoind


What is the minimum infrastructure necessary for Bitcoin to work? Let's say there's some sort of end of the world situation. Everyone's computers still work, but the Internet does not. Would Bitcoin still "work"? Could two people transfer Bitcoins to each other directly?

In case for some reason the Internet stops working, Bitcoin could be incorporated into any transmission medium with enough throughput to at the very least support block propagation. This would require ideally 1MB of data to be propagated through the globe in under 10 minutes. The bare minimum might make it very hard for Bitcoin to work effectively, but media such as radio, telephone or the like could probably handle the Bitcoin load without much problem. Synchronising new people to the Network might be very resource consuming, but still doable.

In case the traditional means of sending information through the globe would become impossible, the Bitcoin Network would become too fragmented to be reliable. While one would still have access to one's Bitcoins locally, one could never be sure if they are dealing with the longest blockchain, thus double-spends could be a serious threat for any transaction, no matter the (local) confirmations.

In such scenario only dealing with Bitcoins that are already stored offline if form of physical temper-proof currency could be useful - Casascius coins for example. One could expect, however, that the coins would depreciate in value along with the exchange rate of (now useless) Bitcoins.

All in all, as long as you can send information around the globe at a decent speed, you can still use Bitcoins.


Why is pycoin getting the incorrect output address? I am using pycoin version 0.52 from pypi and it is getting the wrong output address from a transaction.

Code

# testnet txid and corresponding rawtx
# see https://test-insight.bitpay.com/tx/e20af2349c48774eddda161b74659e3e64ad0f62794df9a2271e6baa313796f2
txid = "e20af2349c48774eddda161b74659e3e64ad0f62794df9a2271e6baa313796f2"
rawtx = "010000000120addc4fc706417fad4158b4b9e30f9289e7dac4918277dc189e03f9a0155064000000006b483045022100b49bae1352d24d9673396bb01a23da583e01c5226347be6cf0f75477cce7f628022062eeb7a5a9b87a97f834660ce417278d4889d525e7e0f947020efdda045d54530121028895b78ad435814caecbeeb43453e4881a96d32c23d61b909dee06ad44c07ad5ffffffff0273a139c3000000001976a914a6d608497ad283ca93c1bdc3abb0a610b8edb18988ac80a81201000000001976a914f4131906b10615a61af347c56f1223ddc214f95c88ac00000000"

from pycoin.tx.Tx import Tx

tx = Tx.tx_from_hex(rawtx)
out = tx.txs_out[1]

print "expected", "n3mW3o8XNMyH6xHWBkN98rm7zxxxswzpGM"
print "actually", out.bitcoin_address()

Output

$ python test.py
expected n3mW3o8XNMyH6xHWBkN98rm7zxxxswzpGM
actually 1PFYkk3YZLY2KqotUBPmJwYo8yNFz3Nxyy

The library is assuming you are using main network Bitcoin, so it prints addresses that start with 1. You need to tell the library you are using that you're in testnet mode.

This seems to be the relevant file: https://github.com/richardkiss/pycoin/blob/master/pycoin/networks.py


I am new to Bitcoin, how can I get started? I am new to both StackExchange and to the new online currency called Bitcoin. I understand what Bitcoin is and how it works, but I was wondering: how do you actually get started with Bitcoin? I have read some articles about mining and the different things you can do to actually get some money in profit, but none of the articles actually go into depth with how to actually do all these things. I was wondering if anyone in the community could help me and make any suggestions to me and those who want to get started in the new currency.

We get a lot of questions revolving around the questions and problems faced by
new users of Bitcoin. While some of this is beyond your question, this answer might work as a potential lightning rod for some of the questions that get asked anew here almost daily. In the following you find a few hand-picked questions that are likely of interest for new users.

What is Bitcoin?

What is a good way to concisely explain Bitcoin?
What are some good resources for understanding Bitcoin?
What's the difference between a wallet and an address?
The Bitcoin.it wiki says addresses do not carry balances...but all info suggests otherwise

Where to get a wallet?

In order to receive and send Bitcoin you need a wallet.

What is a good resource to help newbies choose their first wallet/s?
How many addresses does my wallet.dat contain? Do I need to make a new backup every time I make a transaction?

How do I get Bitcoin?

How do you obtain bitcoins?
What's a good resource explaining the best ways to buy Bitcoin (noob friendly)?

What gives Bitcoins value?

Where do bitcoins come from and what gives them their value?
How is the exchange rate for Bitcoin established?

Where can I spend Bitcoin?

Where can I go to find a list of merchants who accept bitcoins?

What skills are necessary to use Bitcoin?

What's the minimum age to join or use Bitcoin?
What software and skills do I need?

What is mining? How does it work?

What exactly is Mining?
What is the rationale behind Bitcoin mining?
Can someone explain how the Bitcoin Blockchain works?

Is Mining profitable? How can I get started?

How much Bitcoin will I mine right now with hardware X?
How can I start mining Bitcoin?
Why does mining profitability tend towards zero?
In the ASIC-age, is it worth starting mining Bitcoin at home?

How do I get started with Bitcoin.Stackexchange?

Check out our Tour for a quick overview.
Some pointers on asking questions: How to Ask
More helpful info can be found in the Help Center
If you are looking for some interesting reads, check out the most frequently asked questions
Swing by our chat: Bitcoin Lounge


Alternative uses for last five decimal places of an individual Bitcoin (0.000xxxxx) At the current conversion rates only the first three decimal points of an individual Bitcoin can be exchanged for a USD equivalent.  e.g. 0.002 BTC equals 2 USD cents.

That opens up possibilities for using the last five decimal places of a Bitcoin to include "metadata" about the transaction.

What alternative usages are there for these few bits and is anyone using them?

One idea that comes to mind is to use them as a transaction ID to bind the sender to the recipient instead of generating a unique Bitcoin address per sender.  If done carefully, this may allow more versatile use of vanity addresses.

Since the address space of the transactions is relatively small (only 5 digits to play with), one idea is to use a random 4 digit suffix that is valid for a short period of time.  Use the final / Fifth bit as a checksum that can also be ommitted if the conversion rate BTC to USD exceeds $100 but is below $999

Example

An item costs 10 BTC, and the buyer clicks "check out"
The seller creates a new transaction ID (9998) records it, and makes it expire in 1 day.
The seller calculates the checksum.  Since the sum of 9+9+9+8 is 35, an odd number, the checksum is set to "1".  (if it had been even the checksum would be "0")
On checkout the seller pays 10.00019998 BTC to the seller, possibly to a vanity address
The payment is received by the seller and visible in the transaction history.
The seller does checksum of the transaction (9998) with the checksum bit (1) and passes
The result is even so the transaction is valid (less likely a typo was made)
The seller looks up transaction ID 9998 in the database.  If the Tx is invalid, or the date is greater than 24 hours, then a refund is sent to the seller.


Connecting to Bitcoin wallet outside of LAN to 'Solo' Mine For educational purposes only...

Scenario:
My friend and I want to solo mine on 1 wallet. But, his computers are not on\in my LAN network.

The wallet has been set to server mode:
-server

bitcoin.conf
rpcuser=user
rpcpassword=pass
server=1

cgminer settings:
-o localhost:port -u user -p name

This works fine for solo mining on just my computer. But how can I change it so that he can connect to my Bitcoin wallet from another state which is obviously outside my LAN?

You just need to throw this into your bitcoin.conf
rpcallowip=1.1.1.34 where the allowed ip is your friends and also make sure the port isn't going to be blocked by the router.

Is it solo mining? When there is a second party it now becomes pooled mining.


Bitcoin Orphan blocks - short question about the "time lag" factor and proof-of-work "size" "However, it is possible that two miners produce a block at a similar
  time. This situation occurs because the acceptance of the blocks into
  the blockchain by the nodes of the blockchain network does not happen
  instantaneously.

  This time lag in accepting a block may lead to another miner solving
  for the same exact block. But only the block with the larger size of proof of work gets accepted into the blockchain."

This is the background of how orphans are produced and handled.

Can you please explain in short

1) What is this "time lag" ? I would like to understand (detailed) what happens during this time lag, what are the full nodes exactly doing during this time until they decide to accept the block into the blockchain? Is this maybe the moment where the nodes check for all the bitocin protocol rules (refering to https://en.bitcoin.it/wiki/Protocol_rules)? Or sth else
2) What is the "size of the proof of work" exactly? Is it maybe the number of leading "zeros" in the proof of work hash, or the "nonce" number, or sth else? On which parameter must you look to know which block was the result of a more "complex work"?
3) Above mentioned protocol rules: When exactly are the nodes (or the network) checking for them, at which exact step of the bitcoin transaction/consensus cycle?: Before miners receive the transactions, after miners receive the transactions but before they start to work on the PoW hashing puzzle, or after they solved the puzzle and broadcast the block to the nodes?

Thank you

What is this "time lag" ?

When a miner finds a block, they will broadcast it to the network. As with all real-world networks, there is a latency (“lag time”) for this information to be received by the other nodes in the network. Specifically, there will be some amount of latency between the miner that found the block, and other miners on the network. Even if the latency is small (milliseconds), there is still some chance that another miner will find a block within that “lag time”.

  What is the "size of the proof of work" exactly?

Nodes will follow what is colloquially referred to as the “longest chain”, but in reality they are following the “chain with the most work” (the difference is subtle, but important). Each valid block is equally valid, so for there to be “more proof of work” on one chain is to say that chain is “longer”, and thus the valid chain.

If two miners find valid blocks at the same block height, it will not be clear which block will become a part of the eventual longest chain, until a miner finds a new block that builds upon one of those two blocks. At that point, the longer chain will become clear, and the network’s nodes will follow it.

  Above mentioned protocol rules: When exactly are the nodes (or the network) checking for them

The consensus rules are defined by the source code itself, there is no formal specification.

When a node on the network hears about any new transaction or block, it will run a series of checks to determine that transaction/block’s validity. If it is invalid, it is discarded.

When a miner assembles a block template, they will choose only transactions they have determined to be valid, and carefully craft the block to be valid also. So this is done before they start hashing, otherwise they would be wasting hashpower by creating an invalid block.


Mining process in a blockchain Let's consider a blockchain. They mining nodes are listening to transactions and every one is building is own block. Due to latency and other issues, every miner is probably building a different block, at a different speed. At this point, i have some questions:

1) When the consensus algorithm will start? There is like a timer? (For example: "every 10 minutes the consensus algorithm starts, with the purpose of putting a new block in the blockchain")

2) Can a miner create more than one block before the consensus algorithm start ? For example, it finishes a block and before this block goes under the consensus algorithm, it creates another one.

2) When the consensus algorithm start do it consider the blocks builded by all the miners ? And if some miner haven't finished building one's?

3) Is the order of transaction in a block important ? Must the transactions in the blocks respect the chronological order of the correnspondent "real" transaction (A sends 9 bitcoins to B) ?

Thanks

There is no "consensus algorithm" that starts and stops as you are asking. There isn't a timer and there isn't anything that nodes communicate other than blocks.

The process of updating the blockchain (i.e. the consensus algorithm) is always running and "wakes up" whenever a new block is received. It is run by nodes by themselves as there is no need to communicate with other nodes except to receive new blocks. Updating the blockchain only works on complete and valid blocks.

The process of every node receiving a new block and updating their own view of the blockchain is the  consensus algorithm.

  Due to latency and other issues, every miner is probably building a different block, at a different speed.

They are building different bllocks because they are different miners. Each miner is working on their own  unique block. They probably are not working on blocks at different heights.

  1) When the consensus algorithm will start? There is like a timer? (For example: "every 10 minutes the consensus algorithm starts, with the purpose of putting a new block in the blockchain")

It "starts" within a node when it receives a new block. There is no timer, and it is  not a networkwide algorithm.

  2) Can a miner create more than one block before the consensus algorithm start ? For example, it finishes a block and before this block goes under the consensus algorithm, it creates another one.

Sure. When a node receives a new block before it has validated previous ones, the new block is partially validated (the parts that don't rely on previous blocks are checked) and then it goes into a queue.

  2) When the consensus algorithm start do it consider the blocks builded by all the miners ? And if some miner haven't finished building one's?

Then those miners lose the race and get nothing. Consensus only cares about complete and valid blocks. Whatever other miners are doing does not matter unless they too broadcast a valid block for that height.

  3) Is the order of transaction in a block important ? Must the transactions in the blocks respect the chronological order of the correnspondent "real" transaction (A sends 9 bitcoins to B) ?

Yes, kind of. The order for two independent transactions does not matter. If transaction A came first and transaction B (which has no relation to transaction A) is second, a block can have B then A and that does not matter. The point of blocks is to establish the chronological order anyways.

But if transaction B relies on A (so it spends an output of A), then yes, the order matters. In that case, B must come after A. Otherwise the block is invalid and nodes will reject it.


Confused about input and output spending limitations and consolidation I am sure the answer to this is trivial to someone who already knows the answer, but not to me.
I recently wanted to spend some received bitcoin for the first time and discovered that the associated transaction fee was huge (more than I wanted to spend!), for two reasons:

Fees are presently naturally high due to network congestion.
The address has small amounts of bitcoin from many sources, which apparently is problematic.

I spent some time researching the problem and learned that all money in an address must be spent at once. I read about the analogies to not being able to split a coin. Hence the need for change addresses and such. I learned about "consolidation" and how to consolidate transactions during times of low fees.
Experimentally, I consolidated the 3 inputs of a different address into 1 new address, using a low fee. It took a few weeks for the transaction to confirm, but now has successfully made that money more spendable, because the consolidation reduces future fees. Okay, fair enough.
Now I want to do that to my main bitcoin address which has 22 received inputs. So I will consolidate them all with a (relatively) low fee, into 1 new address, which, when it finally confirms, I will finally be able to spend.
But entirely by accident I discovered something weird in Electrum:

If I right-click an address, there is a secret feature "Spend from" which lets me select the source address. (This is useful, because previously the only way I knew to select the source address was to fudge the spending and fees numbers until they exactly matched the total of a particular address, which tricked the program into using that address.)

On the "Send" tab, Electrum then lists each individual received input to that source address. If I right-click the individual inputs, I can remove them. WHHHAAT?!?!?

This contradicts everything I spent days reading about, which was that I had to spend the entirety of inputs at once.
Is this configuration valid? Or will there be an error when I try to commit the transaction? Or will all the other inputs to the address be permanently lost? I am too scared to try it.
Perhaps, for example, the design purpose of being able to remove specific inputs from a transaction is a way to purge "dust", to prevent an attack whereby somebody could DoS a bitcoin address by sending it many 1-satoshi inputs, causing the address to become practically unspendable without incurring a fortune in fees. But this design would discard the unused inputs forever, or gift them to miners as fees.
If it is valid to spend only part of an address, and I won't lose the rest, then why did I wait 3 weeks for this silly consolidation lark? And why was Electrum moronically trying to force me to spend all of the address at once, phenomenally increasing the fee when I was perfectly happy leaving the rest of the damn money exactly where it was. And why are there so many articles online explaining why you have to spend inputs all at once?
I am terrified I will lose all my bitcoin if I try this, so I would appreciate links to example transactions on the blockchain to satisfy myself that this partial inputs thingie is valid.

I spent some time researching the problem and learned that all money in an address must be spent at once.

This is incorrect. The concept of an address does not even exist at the protocol level.
A transaction has inputs and outputs. Every output constructs a "coin" which has an amount and a locking script (encoding the conditions for spending it, which is often - but not necessarily - representable as an address). Inputs consume coins (in their entirety - every coin can be spent exactly once). Transactions can be seen as melting down old coins, and reforging new ones with them.
There are no rules about the locking scripts of coins you're spending. They can all be the same, they can all be different, and there may be other coins with the same locking scripts that aren't spent by the same transaction. Simply put, the Bitcoin protocol has no concept of "all coins associated with the same locking script" - this is only added by wallet software and block explorers for human consumption.

Is this configuration valid? Or will there be an error when I try to commit the transaction? Or will all the other inputs to the address be permanently lost? I am too scared to try it.

It is valid.

And why was Electrum moronically trying to force me to spend all of the address at once, phenomenally increasing the fee when I was perfectly happy leaving the rest of the damn money exactly where it was. And why are there so many articles online explaining why you have to spend inputs all at once?

I can only speculate here, but one reason may be privacy. By definition, multiple coins associated with the same address/locking script can be spent by the same people. Thus if you spend in multiple distinct transactions, you're revealing to the network that those two transactions are related to the same entity (you). Because of that, it is preferable to always spend all these coins simultaneously, the minimize how much you reveal.
Of course, in an ideal world you don't reuse addresses, and you never have multiple coins associated with the same address in the first place (except perhaps dust spam).


How can Bitcoin transactions be traced if you can change your address? I understand in Ethereum you can trace it because wallet address never changes. But in Bitcoin you can change your address, no? Thanks.

How can Bitcoin transactions be traced if you can change your address?

In Bitcoin you don't change your address. You create new receiving addresses.

This is normally done so that a new address is created for each new transaction with the intention to increase privacy.

However in each transaction there are inputs and outputs and if a transaction has one input and two outputs, if you can infer which output is change, you know that there is some connection between the input address and the output address. You may be able to then trace that connection further back through a series of transactions. This is approximately like tracing possession of a coin passing through a series of people or businesses in a series of transactions.

This becomes more difficult if transactions have much more than one input and much more than two outputs.

Transactions may have certain characteristics such as address-types, size, timing and so on that may make it possible to make inferences. Transactions with differing characteristics could be inferred as being different parties, those with similar characteristics might be potentially associated with a single party of interest.

For example, if you see a large transaction with hundreds of inputs and one high-value output occur every Friday at 19:00 UTC, you might suspect it was a large exchange moving funds into cold storage as part of it's regular operational procedures. The timing might suggest a specific timezone.

We know that organisations such as the FBI perform blockchain analysis to trace illegal activity. The details of their methods are not published, so far as I know.

See

https://bitcoin.stackexchange.com/search?q=blockchain+analysis which leads to
How can there exist businesses that "specialize in blockchain analysis looking for patterns of usage that reveal how money is being used"?
How can I find a digital forensics expert to help trace stolen bitcoins?
etc


Transaction broadcasts and block synchronization In the original publication about bitcoin, in section 5 it states that

  If two nodes broadcast different versions of the next block
  simultaneously , some nodes may receive one or the other first. In
  that case, they work on the first one they received but save the other
  branch in case it becomes longer. The tie will be broken when the next
  proof-of-work is found and one branch becomes longer;

the author then states

  New transaction broadcasts do not necessarily need to reach all nodes.
  As long as they reach many nodes, they will get into a block before
  long.

My question is: How do lost transactions "get into a block before long"? Are they constantly re-transmitted until they are 6 blocks deep and the proof of work has been completed? Is it possible that a transaction could be re-transmitted indefinitely, and it might never be put into a block that is fully synchronized?

While implementation specific, transactions are only re-broadcasted by the bitcoin-qt client after every x minutes (30?) and only if it's not in the main chain yet. Once a block comes in that has the transaction, it'll stop transmitting. If a new chain is accepted later that doesn't have the transaction, it will start broadcasting again.
About transactions getting lost, I already wrote an answer about that once :

Most clients on the network have a transaction pool in their memory. The same basically applies to miners: they just dump the top 500KB (or some other value) transactions into a block, sorted by transaction fee (descending, of course). When there aren't many transactions, maybe because of a series of block in a short amount of time, it will be confirmed anyway.
But to answer your actual question: yes, transactions (sort of) expire. When you send a transaction, it sends a tx frame to all connected peers. These peers store the transaction in their memory pools and tell all their connections that they have a new transaction. When those connections don't have it yet, they ask for it, and that's how a transaction spreads over the network.
At some point every node in the network will have the transaction in their memory pool, and at that point it will no longer be sent over the network. Now when a user restarts their client, the memory pool is wiped, and the transaction is deleted from that computer. (Plus a few other ways to delete transactions from the pool)
Because of that it's very unlikely for the transaction to be gone from the entire network, but in case it does happen: the reference client will automatically re-send the transaction every x hours(/minutes?) when it's still not confirmed.
Oh, and I forgot the most important part: transactions on Bitcoin (tx frames in the protocol) don't have a 'time' field, which means that transaction expiration can't be a feature of Bitcoin.
To summarize: yes, the transaction can expire, but that is really unlikely.


How to check if an address is valid in Bitcoin Cash? A lot of users seem to be mistakenly sending Bitcoin Cash to Bitcoin addresses and vice versa. I understand Bitcoin Cash doesn't support SegWit and that if Bitcoin Cash is sent to a SegWit Bitcoin address then the Bitcoin Cash is not currently recoverable.

How can I check if a particular address is valid on Bitcoin Cash?

You can't. Most segwit addresses are actually p2sh addresses that are wrapped around segwit. As it is impossible to determine what the redeem script of a p2sh will look like there is no way of telling them apart. In summary: If an address starts with a 3 it is impossible to know if its segwit, multisig or something else. If an address starts with a 1 it is safe to send to it, the private key to access the funds will be the same on both chains.


Open source wallets to host on our website We are a team of experienced devs, also with experience and knowledge of Bitcoin, but with zero experience so far in Bitcoin/blockchain specific development.
We would like to host a Bitcoin wallet on our website and are exploring the development lift required from open source options. There will be frequent deposits/withdrawals, internal transactions and naturally security is of the highest priority.
Any advice on avenues to explore (and pitfalls to watch out for) as we assess options would be very helpful.
Thanks,

With all due respect, the first answer that you received to this question is wholly inaccurate.
'Bitcoin Core' is a client (not a library or a wallet).
You're looking for something like 'BTCPayServer', which is a completely autonomous, self-hosted wallet solution that requires a server to spin and allows you to control every aspect of your interaction with the source code on a granular level with as much fine tuning as you desire.
Here's the site: https://btcpayserver.org/
There's a live demo for you to play with along with a wealth of documentation.