When I exit SSH session bitcoind goes down I'm using Ubuntu 12.04.

I've tested several scripts that try to get bitcoind running on startup but none have worked out for me.

I'm getting a little bit desperate because I can't even get bitcoind running once I exit my SSH session.

Any clues on how to get bitcoind running once I exit the SSH session?

Best Regards,

You could use screen or a similar tool like tmux or byoblu.
Otherwise use the NOHUP command.

nohup is a POSIX command to ignore the HUP (hangup) signal. The HUP signal is, by convention, the way a terminal warns dependent processes of logout.
Output that would normally go to the terminal goes to a file called nohup.out if it has not already been redirected.
nohup is a low-level utility simply configuring a command to ignore a signal. As seen below, nohup is very far from being a full-featured batch system solving all the problems of running programs asynchronously.

  $ nohup abcd &

  $ exit

Alternatives:
The screen or tmux command can also detach a process from the current shell. It allows to reattach to the process later on.
e.g. the following call will run somescript.sh detached from SIGHUP and in the background:

  $ screen -A -m -d -S somename ./somescript.sh &

https://en.wikipedia.org/wiki/Nohup

My advice is to learn to use screen (or tmux) so you can later re-attach the process to the main shell and interact with it.


Does Cryptsy reuses market IDs? Cryptsy has a lot of markets. Each market has its own ID. Now markets have an ID in the range [1,220]. Sometimes old markets are deleted. Are the IDs of that markets reused or not?

I have the same question for Bittrex and MintPal

They don't reuse market IDs. For example, SaturnCoin (SAT) has been deleted and replaced with SAT2. That was market ID 168(search for cryptsy. It links to https://www.cryptsy.com/markets/view/168). If you want to go there, you'll be redirected to the home page. SAT2 has market ID 233. Why wouldn't they replace SAT/BCT with SAT2/BTC? Anyhow, market 248 (latest at the moment) does also exist, which is later introduced then SAT2 and probably also later then the removal of SAT. Based on this, I think I can safely say they will not reuse the market IDs. And why would they? It will only be confusing and frustrating.

For the other two exchanges, I am 100% sure they will not reuse their IDs. If you go to a specific markets, the url consists of something like BC/BTC. Unless their is some new coin stupid enough to launch with the same abbreviation , there is no chance it will have the same ID.


Bitcoin gone missing I've sent bitcoins from one wallet to another, the transaction has over 30 confirmations but its not even appearing in my wallet as pending. Ive checked the address and it matches. What could be the issue? It was from coinbase to electrum.

May be:

You sent to incorrect address
Electrum have not synchronized yet


Is it possible to create a unified client that manages multiple cryptocurrencies? Is it possible to create a unified client that manages multiple cryptocurrencies? Does such a client already exist?

MuCoWa is a multicoin wallet that supports BTC, LTC, DOGE, QRK, FTC, CGA, and DGC. They charge 0.15% fees to send though.


What is the fastest way of litecoin mining? I have searched whole the Internet but it looks like that there isn't any fast way of mining litecoin.

Most powerful CPUs just mine about 200 Kh/s and the most powerful GPUs mine around 900 Kh/s.

And I haven't seen any hardware like ASICs for litecoin mining yet.

So what is the fastest way of mining litecoin??? I think it's impossible to mine with a 4000$ gpu and just get 900 Kh/s so is any minig hardware going to be produced ???

To my knowledge, all public manufacturers of scrypt asics has ceased their operations. This doesn't mean that there's no scrypt asics being produced, just that they aren't for sale on the open market. If you really want to mine, your best bet is to buy some used equipment on Ebay. However I doubt you'll be profitable, since you have to compete against huge Chinese farms with close to zero electricity costs.


Are there Bitcoin password crackers I can use to recover forgotten passwords? I've lost the password to one of my wallets (it's a small one, don't worry). I was sure I remembered the password ... but evidently I don't.

Is there a program that I can use to brute-force my password, given hints?

Meaning, suppose that I remember that my password was "abc", but in fact maybe it's "Abc" or "Abc0". I would give the cracker program the string "abc" as a hint, and it would try a lot of permutations on it until it finds the real password.

Does such a cracker program currently exist? (Reliable sources please, hopefully open source)

Revalin made available a sript that you can try running:

http://bitcointalk.org/index.php?topic=85495.msg942171#msg942171

There may not yet be anything else, but you'ld probably find someone willing to write one if you offered to send your wallet along with what you think the pass phrase might be and ask only for a fraction of the wallet's bitcoins back once cracked.


Bitcoin Transaction Fee Does the bitcoin transaction fee depend on the number of addresses in the proverbial from field or the number of transactions that led to the balance in the addresses in the from field.
eg:
I have 10 addresses each containing 1 bitcoin,is it better to send them from where  they are to another person or if I transfer all the bitcoins in every address to a single address and then sent the bitcoins from there. I am only talking about the transaction fee in the final send to the other person.

Basically, one or a few number of inputs should make no real difference. But at some point the size of the transaction may grow so big that it will start to get less priority over other ones, because miners may prefer lower-sized transactions to get more transactions fees (assuming they would hit regularly the block size limit).

Anyway the workaround you propose is pointless, moving bitcoins separately from several addresses to one unique address prior of the real transaction would cost you even more. The total size of all the transactions you need for that would exceed the size of a unique direct transaction with several inputs.

BTW, notice that the virtual balance your client shows for each of your “accounts” may not reflect the real repartition as seen by the network for each associated address. (It costs nothing to move virtual amount from one account to the other, but it will also not change the way transactions will be build later by the client).


How to fund a bidirectional channel in Lightning Network by two participants? (Edited) I brought up a similar question here: (Link to question) for a payment channel (in general case and without specifying which payment channel implementation.) Since this funding channels depends on the platform and implementation, I bring up that question specifically for Lightning Network (last version).

How to fund a bidirectional channel in Lightning Network (last version) by two participants?

To clarify better the question, I bring up following scenario:

Assuming two users want to create a bidirectional channel between themselves such that user_1 wants to pay n BTC to user_2 at the end. And user_2 wants to pay m BTC to user_1 at the end.

So, the capacity of this channel must be (n + m) BTC. Logically, n BTC of channel's capacity must be provided by user_1 and m BTC of channel's capacity must be provided by user_2.

However, since they create together only one channel between themselves, how can they manage capacity of this channel? Since the channel is bidirectional, it is wisely, logical and fair that its capacity must be funded by both users, so how can they establish this channel together with (n + m) BTC ?

Please note that:
(1) non of users do NOT trust each other and (2) do NOT want to finalize a micro-payment (settlement) before capacity of the channel becomes (n + m) BTC.

Edit: Here: (Link to answer) it's mentioned by @Jestin that : "the fee must be paid by whichever party creates the funding transaction." If so, each of both users prefer NOT to create the funding transaction to avoid paying fees. What happens in a situation users do not know and do not trust each other? What does incentive one of users to be volunteer to pay the fees?

Note: If you think that question is not clear enough, please let me know.

1) Peer A sends msg to Peer B

Unsigned Funding TX template including:
// Input A (unsigned, just outpoint)
// Output A (change)

2) Peer B sends msg to Peer A

Completed unsigned Funding TX template, which adds:
// Input B (unsigned, just outpoint)
// Output B (change)
// 2-of-2 Multi-sig Output (still requires sig A, sig B)
Signature for Peer A's first commitment Transaction (Unsigned funding TX is completed, so TXID is non-malleable for witness transactions. Commitment TX's can therefore be signed without risk of being invalidate by parent malleability).

3) Peer A sends msg to Peer B

Signature for Peer B's first commitment Transaction.
Now both commitment Transactions (for A and B) are signed.

4) Peer B sends msg to Peer A

B's Signature for funding transaction.
Now A has complete Funding TX after signing itself.

Caveat: If Peer A fails to respond after step 4, Peer B must double-spend its funding input to prevent future interference.


Displaying price in ETH based on USD exchange rate How do i get the ETH rate in USD, and stored in a variable in php?

There are an huge number of different sources, for instance CoinMarketCap have all the existing coins with the relative value in dollar, computed by averaging over many exchanges.


Can the signers of a 2 of 3 multisig tx be identified later For accountability reasons:

If public keys of each signer is known, can the 2 out of 3 parties be identified later, or just that it was some combination of the 3 parties?

If the 2 parties can not be identified, how should this be done if its necessary?

When spending a multisig output, the signatures and redeem script are public information.

This allows you to identify:

The number of potential signers
The number of required signatures
Public keys for all potential signers
Which keys signed the transaction (from the signature).

It will not reveal the identity of who owns a public key, unless you have some offchain analysis to go with this data, and already know who owns which public key.


How to cleanup mempool I want to cleanup mempool.
I googled and knew -zapwallettxes might clean up mempool.

But when I do the following command, mempool is still loaded.

  ./bitcoind -testnet=3 -server -rest -dbcache=4000 -txindex=1 -rpcbind=0.0.0.0 -rpcallowip=0.0.0.0/0 -printtoconsole -zapwallettxs=2 -rescan

In this situation, even if I restart bitcoind, mempool is dumped to .bitcoin/testnet3/mempool.dat and loaded on startup.

how should I clean up mempool?

Any comments and advices are welcomed :)

First of all, clearing your mempool doesn't really do anything if the transactions you're clearing have already propagated through the network. The mempool will sync again when you connect to other peers.

mempool.dat was introduced in 0.14.0 and will persist the mempool on shutdown. In order to clear the mempool you have to:

Shutdown Bitcoin Core $ bitcoin-cli -testnet3 stop
Delete mempool.dat $ rm ~/.bitcoin/testnet3/mempool.dat
Restart the daemon $ bitcoind -testnet -zapwallettxes

Note: You might also need start the daemon with -zapwallettxes so the transactions related to your wallet aren't loaded into the mempool at startup.

Another Note: If you only want to remove transactions related to your wallet, you can skip step 2: https://github.com/bitcoin/bitcoin/pull/10330


Need explanation - limit buy order (Cryptopia) If there are sell orders like this:

selling 200 XXX - 100 satoshis per coin
selling 200 XXX - 101 satoshis per coin
selling 200 XXX - 102 satoshis per coin
selling 200 XXX - 103 satoshis per coin
selling 200 XXX - 104 satoshis per coin
selling 200 XXX - 105 satoshis per coin
...

If I put buy order like this: "Buying 600 XXX for price 105 satoshis per coin - total 63000 satoshis" (and let's assume that I have 1 BTC)  - what will happen? Will I spent 63000 satoshis and get more than 600 XXX coins or I will buy exactly 600 XXX for less than 63000 satoshis and what will happen with remaining satoshis for that trade? To rephrase, will my order be filled after spent 63000 satoshis or after buying 600 XXX and what will happen with remaining satoshis for that trade?

When new orders are added to the orderbook, they are first matched against the most favorable existing orders. If the newly added order cannot be fully fulfilled, the remainder is put on the order book.

Your order would be limited to buying 600 coins and at a price of 105 satoshis. It would be filled after buying 600 coins. To have an order fulfill at a total amount to spend, you'd give a limit in the amount you want to spend rather than a number of coins you want to purchase. Defining all three, a number of coins to purchase, a maximum price you're willing to pay per unit and a maximum amount you're willing to pay is possible, but will not hit all three of your restrictions unless you get exactly the price you're aiming for.

In your example that would mean that your buy order would first match the sell order at 100 satoshis/coin, then match the 101 satoshis per coin and finally be exhausted by matching the 102 satoshis per coin. You'd have purchased 600 XXX at a total of 60600 satoshis.

If in your example the sell orders were each for 50 XXX, the resulting order book would look like this:

Before:
selling 50 XXX - 100 satoshis per coin
selling 50 XXX - 101 satoshis per coin
selling 50 XXX - 102 satoshis per coin
selling 50 XXX - 103 satoshis per coin
selling 50 XXX - 104 satoshis per coin
selling 50 XXX - 105 satoshis per coin
selling 50 XXX - 106 satoshis per coin
…

matching:
>selling 50 XXX - 100 satoshis per coin
>selling 50 XXX - 101 satoshis per coin
>selling 50 XXX - 102 satoshis per coin
>selling 50 XXX - 103 satoshis per coin
>selling 50 XXX - 104 satoshis per coin
>selling 50 XXX - 105 satoshis per coin
<buying 300 XXX - 105 satoshis per coin
buying 300 XXX - 105 satoshis per coin
selling 90 XXX - 106 satoshis per coin
…

After:
buying 300 XXX - 105 satoshis per coin
selling 90 XXX - 106 satoshis per coin
…

Also see: How do buy and sell orders work?


Bitcoin Core keeps coming up with the error: "error reading from database, shutting down" Bitcoin 0.14.1
Windows 10 Home v. 1703
Bitcoin Core keeps coming up with the error: "error reading from database, shutting down". I've tried deleting the one and only file in the database folder under J:\Users custom made\James\AppData\Roaming\Bitcoin latest\database and restarting the computer, but the same error occurred after the app loaded and was showing the sync progress bar for a minute or so, as previously when the issue occurred today. I am having a similar issue with the Ethereum Mist program, where it crashes after running for a short time. The error on that app also mentioned the filepath to the chaindata. Similarly, I deleted all the chaindata, restarted and the program now has been syncing for many minutes, however it seems like it has started syncing from scratch rather than from where it was up to previously (close to 100%, with only a few thousand blocks left). The debugger for the error in Bitcoin qt in Visual Studio Community says nothing:

To fix this problem you will need to reindex. You have already begun that process by delete the chainstate folder. Bitcoin Core will appear as if it is syncing from scratch, but it is not. It is simply reading through all of the block files already on disk and building its databases. If the reindex does not fix your problems, then you may need to actually resync the blockchain, and if that also fails, then you likely have a hardware error.


0 Active Connection on my-new-coin I have compiled my-newcoin-qt and my-newcoind on different platforms (windows, Linux and Mac), with my coin specification based on litecoin.

When I run my-newcoin-qt at the first time, I get no error but the message:

0 Active Connections

What should I do as the next step? Should I compile seeder software on VPS server?

I bought a droplet on DigitalOcean running Ubuntu 12.04. It is only $5/month. I opened the port, compiled my *coind program on it, created my .conf file and ran it. Now my client coin programs connect to it.


How can I convert a wallet.aes.json file from Blockchain.info to a wallet.dat file? I'd like to convert my Blockchain.info wallet to a local Bitcoin-qt wallet. How can I do that? (I am fine with using command line tools.)

The way I go about it is as follows:

Login to Blockchain.info and choose export
Export data as BITCOIN QT
Note the private key in the form 5Hxxxx or 5Kxxxx or 5Lxxxxx. Copy and paste this string (or hand write it to be safer; it's case sensitive and has no 0/O, l/I)
Open Bitcoin QT; click help>Console
Type importprivkey PRIVKEY NAME where PRIVKEY is what was copied and pasted and name is the name for the address eg MAIN1
If wallet.dat is encrypted you'll need to type: walletpassphrase PASSWORD 180
Be sure to encrypt your wallet again
Move funds from Blockchain wallets to a new address in case you're concerned about malware monitoring copy/paste


Why is 'p2pkh:' prepended at the beginning of private key addresses in electrum? I recently started a Blockchain course and came across the electrum software. While going through the list of wallet addresses and associated private keys I found that  'p2pkh' is placed at the start of every private key, why is that?

A single private key can lead to different addresses, depending on the script it is used in - These include p2pkh, p2wpkh, p2sh-p2wpkh.

Electrum prepends the script type to the private key during export and import so that it knows which address to derive and check for outputs on.


Bitcore.io Create a raw tx hex (signed) to push to the blockchain I am trying to push a raw transaction to blockr.io testnet using bitcore (current latest version 0.12.9) for node.js https://github.com/bitpay/bitcore

I have constructed my transaction like so:

var unspents=
[ { txid: '67b22a1874be2e748b2c904e2181f85a9d6503001e58c374e17b1161cd5a36f4',
    vout: 0,
    address: 'myHtNgECiAjBctWz1tM2TN2PupWwfHtgMi',
    scriptPubKey: '76a914c2f9958848c465efd042fcb76fef519f03a83ec288ac',
    amount: 100000,
    confirmations: 39 } ];

    var transaction=new bitcore.Transaction()
    .fee(bitcore.Unit.fromBTC(0.0001).toSatoshis())
    .from(unspents) // there is one unspent of 0.001
    .to(bitcore.Address.fromString(payToAddress),0.001)
    .change(myAddress)
    .sign(privateKey);

console.log(transaction.isFullySigned()); // This returns true

When I POST this to blockr.io I serialize it:

'https://'+'t'+'btc.blockr.io/api/v1/tx/push'    // < t at the beginning is for testnet

{'hex':transaction.serialize()} // 0100000001f4365acd61117be174c3581e0003659d5af881214e902c8b742ebe74182ab267000000006a47304402204f5950a8f8e7346e96101da811452246d51741131310f58d5cfdc064e547d3dc02202b817a442bb043a1174fe0703082ebbd7bc622afc00084710be21fa143444d83012102bbe798da887604bdd360dd059061b48816634e44d9f54563af2c727b8bcb3e2fffffffff02a08601000000000017a9149ffdff1f3eea0deb21ed967b91c7ef3cce65b2d68750f2704e180900001976a914c2f9958848c465efd042fcb76fef519f03a83ec288ac00000000

The response I get back from blockr.io is:

[ { status: 'fail',
    data: 'Could not push your transaction!',
    code: 500,
    message: 'Did you sign your transaction?' },
  500 ]

Below is the transaction I sent but as JSON. I'm thinking there is something wrong with it?

{
"version":1,
"inputs":
[{
    "prevTxId":"67b22a1874be2e748b2c904e2181f85a9d6503001e58c374e17b1161cd5a36f4",
    "outputIndex":0,
    "sequenceNumber":4294967295,
    "script":"47304402204f5950a8f8e7346e96101da811452246d51741131310f58d5cfdc064e547d3dc02202b817a442bb043a1174fe0703082ebbd7bc622afc00084710be21fa143444d83012102bbe798da887604bdd360dd059061b48816634e44d9f54563af2c727b8bcb3e2f",
    "scriptString":"71 0x304402204f5950a8f8e7346e96101da811452246d51741131310f58d5cfdc064e547d3dc02202b817a442bb043a1174fe0703082ebbd7bc622afc00084710be21fa143444d8301 33 0x02bbe798da887604bdd360dd059061b48816634e44d9f54563af2c727b8bcb3e2f",
    "output":{
        "satoshis":10000000000000,
        "script":"76a914c2f9958848c465efd042fcb76fef519f03a83ec288ac"
    }
}]
,"outputs":
[{
    "satoshis":100000,
    "script":"a9149ffdff1f3eea0deb21ed967b91c7ef3cce65b2d687"
},{
    "satoshis":9999999890000,
    "script":"76a914c2f9958848c465efd042fcb76fef519f03a83ec288ac"
}]
,"nLockTime":0,
"changeScript":"OP_DUP OP_HASH160 20 0xc2f9958848c465efd042fcb76fef519f03a83ec2 OP_EQUALVERIFY OP_CHECKSIG",
"changeIndex":1,
"fee":10000

}

I signed it with my private key then serialized it as blockr wants it in hex format does this mean I have got to somehow sign it after it's serialized or what?

And what is the deal with these large numbers:

"satoshis":10000000000000,

"satoshis":9999999890000,

UPDATE:

Block chain info instead returns this error:

Unable To find all tx inputs [67b22a1874be2e748b2c904e2181f85a9d6503001e58c374e17b1161cd5a36f4]

The problem is on this line:

amount: 100000,

The amount is supposed to be in coins, not satoshis, according these comments in the code. To fix it, replace that line with

satoshis: 100000,

  And what is the deal with these large numbers:

Since the code was assuming an input with 100,000 coins in the inputs, the change address had a lot more coins in it than there should have been.


How did these zero-transaction fee transactions make it into the Bitcoin network? I thought someone said in this forum that the Bitcoin network screens out zero transaction fee-transactions because they are "dust" transactions and if anyone could submit zero-transaction-fee transactions, people could start a DOS attack and clog the system.  Then I stumbled upon this web site that lists the fees for submitted transactions

https://bitcoinfees.earn.com/

And there are actually a handful of zero transaction fees (as well as a few 1-10 Satoshi transaction fees).  How is this possible?  Did someone game the system and get their transactions in there?

Zero- and low-fee transactions aren't relayed by default.  If you attempt to broadcast one over the Bitcoin peer-to-peer network, most nodes won't pass it along for you (and they might even "ban" you by refusing to relay any of your transactions for a while).  However, such transactions are still valid, and it is perfectly legal for a miner to confirm such a transaction by including it in a block, should they choose to do so.  So this raises two questions:

How would they get ahold of a zero-fee transaction, if they're not relayed?

The miner might have created the transaction for themselves.  For instance, if a mining pool needs to pay its members their earnings, the pool operator could create a transaction and include it in the blocks the pool is attempting to mine.  There's no point in including a fee, because the pool would just be paying the fee back to itself.
Some large miners may have alternate ways to receive transactions (e.g. a web site where anyone can paste a transaction and the miner will consider it).  This is also useful for people who want to create transactions which can't be relayed because they are not standard.

Why would they confirm it?

Obviously most miners are motivated by profit and so they would prefer to confirm transactions with higher fees.  But other than altruism or bugs, here are some reasons why they might choose to confirm a zero-fee transaction.

It's their own transaction, so there is no point in including a fee.  See above.
They've been paid in some other way.  Some miners have "transaction accelerators" where you can pay that specific miner some amount to "buy" faster confirmation.
"Child pays for parent."  If the zero-fee transaction is used as input by another "child" transaction which has a high fee, the two transactions together might have a higher average fee than any other two available transactions.  The miner can't confirm the child without also confirming the parent, but it might be worth it to collect the child's fee.


Bcoin - running webpack-app issue I have cloned bcoin repo and installed webpack package. When trynig to run webpack-app I get the error below:
btc@ubuntu:~/bcoin/node_modules$ npm run webpack-app
npm ERR! missing script: webpack

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/btc/.npm/_logs/2020-11-18T08_55_31_312Z-debug.log

I have checked the node_modules folder inside the bcoin dir and couldn't find webpack-app package. Also, I excatly followed the instructions from https://bcoin.io/guides/browser
nodejs version: v10.19.0
npm version: 6.14.4

bcoin does not use webpack anymore, and in fact the browser node as a proof of concept isn't really being maintained since it is practically very silly :-)
The webpack config files were removed form the repo here and here. If you REALLY want to try the browser node, you will need to checkout a git commit of bcoin from before those changes were made.
The bcoin library can still be compiled for browser usage in simple webapps and is still very useful for small applications like that. I refer you to this guide: https://bcoin.io/guides/webapp.html ...which uses bpkg instead of webpack or browserify.
That browser-node guide should probably just be removed, or at least updated with a deprecation notice. If you feel like it you can make a PR to the website here: https://github.com/bcoin-org/bcoin-org.github.io
Feel free to join us on IRC #bcoin or on Slack to chat more about this.


How to sign a PSBT transaction? I have a PSBT (in Base64 format) which I need to sign using GoLang, but I can't figure out which steps I need to do that. I found this but I'm not really confident with Bitcoin and Python, so I didn't fully understood the Signer Algorithm. What should I do?

As I commented, with the psbt package from btcsuite/btcutil it is possible.

I have created an example of how to use it. I don't know if this is the best/most efficient way of doing it. But I hope this gives you a template and example to work with. But it is relatively low-level and without some deeper technical understanding of Bitcoin it may be difficult to follow.

It spends the second (0-indexed) output from this transaction on Testnet.

package main

import (
    "bytes"
    "encoding/hex"
    "fmt"

    "github.com/btcsuite/btcd/chaincfg"
    "github.com/btcsuite/btcd/chaincfg/chainhash"
    "github.com/btcsuite/btcd/txscript"
    "github.com/btcsuite/btcd/wire"
    "github.com/btcsuite/btcutil"
    "github.com/btcsuite/btcutil/hdkeychain"
    "github.com/btcsuite/btcutil/psbt"
)

const (
    // Provided PSBT with one P2PKH input. Created in part 1 below.
    psbtBase64 = "cHNidP8BAFIBAAAAAX7Mj1abZbFtfUYFYBIFRKxCOxs8wfMRu3NhVBHTbnFfAQAAAAAAAAAAAayEAQAAAAAAFgAU8yFPpRndMpAJ7aO+RtRN4Nh3mbYAAAAAAAEBH6CGAQAAAAAAFgAUJw/E3xSMUU+8VVGHXk7Dc4vGNjkiBgOoVLKI2rj2DMlswSDkSf0KR7jQHULLPOWS/x3q8b3MqQyj8e/WAAAAAAMAAAAAAA=="

    // Extended Private Key.
    extPrivateKeyStr = "vprv9GpFMh8VMAXKgdZVFGXFvsexjr25MHKvtCY7vKHbRr8A6xCm4bQYbQrJmLz6h3F9MGf5edwxQuZR7DCLFVvjMxgfJ9so9mcN2SHGR3QFr3S"
)

// Part 1: Creating the PSBT (will be returned as base64)
func part1() string {
    // The extended private key was generated with Electrum and we derive the
    // specific key used.
    // `keyC` contains the private key that _contains_ the coins to be spend.
    keyC, _ := hdkeychain.NewKeyFromString(extPrivateKeyStr)
    fingerprint := keyC.ParentFingerprint()
    keyC, _ = keyC.Child(0)
    keyC, _ = keyC.Child(3) // Electrum derivation of the 4th address.
    pubKeyC, _ := keyC.ECPubKey()

    // Create a brand new PSBT spending the following outpoint.
    txhash, _ := chainhash.NewHashFromStr("5f716ed311546173bb11f3c13c1b3b42ac4405126005467d6db1659b568fcc7e")
    outpoint := wire.NewOutPoint(txhash, 1)
    inputs := []*wire.OutPoint{outpoint}
    pubkeyScript, _ := hex.DecodeString("0014270fc4df148c514fbc5551875e4ec3738bc63639")
    spendTxOut := wire.NewTxOut(100000, pubkeyScript)

    // The address and amount to send funds to.
    outAddress, err := btcutil.DecodeAddress("tb1q7vs5lfgem5efqz0d5wlyd4zdurv80xdkfkf3cn", &chaincfg.TestNet3Params)
    // The witnessScript consists of a `0x00`, followed by the size of the
    // pubkey-hash `0x20` and the pubkey-hash itself.
    witnessScript := append([]byte{0, 20}, outAddress.ScriptAddress()...)
    outputs := []*wire.TxOut{wire.NewTxOut(99500, witnessScript)}

    // Create the psbt instance.
    pC, err := psbt.New(inputs, outputs, wire.TxVersion, 0, []uint32{0}) // Note: typically the sequence is `0xffffffff`!
    if err != nil {
        panic(err)
    }

    // Use the Updater to add information to the input.
    u, err := psbt.NewUpdater(pC)
    if err != nil {
        panic(err)
    }

    u.AddInBip32Derivation(fingerprint, []uint32{0, 3}, pubKeyC.SerializeCompressed(), 0)
    u.AddInWitnessUtxo(spendTxOut, 0)
    u.AddInSighashType(0, 0)

    // Show the base64 encoding of the unsigned PSBT.
    b64, _ := pC.B64Encode()
    return b64

}

// Part 2: Sign the PSBT in base64 encoding and return it.
func part2(psbtBase64 string) string {
    // Reader for the PSBT.
    psbtBytes := []byte(psbtBase64)
    r := bytes.NewReader(psbtBytes)

    // Create instance of a PSBT.
    p, err := psbt.NewFromRawBytes(r, true)
    if err != nil {
        panic(err)
    }

    // Load the extended private key.
    bip32Key, err := hdkeychain.NewKeyFromString(extPrivateKeyStr)
    if err != nil {
        panic(err)
    }

    // Derivation path should be read from PSBT.
    // Note: We ignore checking the fingerprint, etc.
    path := p.Inputs[0].Bip32Derivation[0]
    for _, d := range path.Bip32Path {
        bip32Key, _ = bip32Key.Child(d)
    }

    pubKey, err := bip32Key.ECPubKey()
    if err != nil {
        panic(err)
    }

    privKey, err := bip32Key.ECPrivKey()
    if err != nil {
        panic(err)
    }

    // Manually creating the signature.
    sigHashes := txscript.NewTxSigHashes(p.UnsignedTx)
    sig, err := txscript.RawTxInWitnessSignature(p.UnsignedTx, sigHashes, 0,
        p.Inputs[0].WitnessUtxo.Value, p.Inputs[0].WitnessUtxo.PkScript,
        txscript.SigHashAll, privKey)

    // Use the Updater to add the signature to the input.
    u, err := psbt.NewUpdater(p)
    if err != nil {
        panic(err)
    }
    sucess, err := u.Sign(0, sig, pubKey.SerializeCompressed(), nil, nil)
    if err != nil {
        panic(err)
    }
    if sucess != psbt.SignSuccesful {
        panic("could not sucessfully sign for some reason")
    }

    // Finalize PSBT.
    err = psbt.Finalize(p, 0)
    tx, err := psbt.Extract(p)

    var buf bytes.Buffer
    tx.Serialize(&buf)
    return hex.EncodeToString(buf.Bytes())
}

func main() {
    fmt.Println("Base64 PSBT: ", part1())

    fmt.Println("Signed tx: ", part2(psbtBase64))
}


bitcoind sync is utilising very little CPU and bandwidth and is very slow Is there a way to increase the sync speed. It's running in single thread on raspberrypi connected with USB HDD.

top

top - 13:58:12 up 32 min,  2 users,  load average: 2.64, 1.74, 0.80
Tasks: 138 total,   1 running, 137 sleeping,   0 stopped,   0 zombie
%Cpu(s): 10.1 us,  2.6 sy,  0.0 ni, 56.3 id, 30.9 wa,  0.0 hi,  0.1 si,  0.0 st
KiB Mem :   947732 total,   101584 free,   239716 used,   606432 buff/cache
KiB Swap:        0 total,        0 free,        0 used.   623092 avail Mem

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
 1594 necktwi   20   0  345160 198200   7864 S  50.8 20.9   1:33.10 bitcoind

nethogs

NetHogs version 0.8.1

    PID USER     PROGRAM                    DEV        SENT      RECEIVED
   1594 necktwi  bitcoind                   enxb82     0.234       1.388 KB/sec

actually, I have a bandwidth of 6MBps.

Make sure you are connected to enough peers (maybe >4)
Make sure you use either the default -par config value or you set it according to your available CPU cores (usually num of cores +1)
Make sure, you have fast disk access (ideally SSD). If disk access is slow (don't use NFS, NAS, etc.), it could tear down the verification process (leaving your CPU partially unused)
Try to change the default database cache size. A -dbcache of 4GB can really significant speedup the sync, though don't over-allocate if your system has not plenty of RAM to waste.


What is the Ripple equivalent of the "51% attack?" In Bitcoin, if a participant gains control of more than 50% of the hash power, they can execute a double-spending attack. The "attack" could come from within, say if the existing powerful miners decide to change the rules.

Does Ripple have a similar problem, where a few people can effectively take control of the system? If yes, how does it work?

Ripple solves the double spend problem by consensus. Everyone who wants to run a server on the Ripple network picks a set of validators and tries to reach a consensus with them on which transactions are valid.

The Ripple equivalent of Bitcoin's 51% attack would be if some group obtained control over enough validators that the consensus process failed. Because people specifically select validators that they believe are unlikely to collude, this would be an exceptionally difficult thing to do.

If validators refuse to come to a consensus with each other, this is detectable to other validators. They then pronounce the network broken (because they don't know which side is right).

In this case, servers would declare the Ripple network unusable automatically. Until the problem was resolved, no transaction results could be relied upon.

The solution would consist of analyzing the signed validations and proposals to see which validators were being unreasonable and for all honest people to remove those validators from the UNLs (lists of validators they try to come to a consensus with).

So you would have to gain people's trust and then in the process of making the attack you would lose that trust and have to start over again.

By contrast, if someone acquired ASICs to attack Bitcoin, they could attack Bitcoin repeatedly. It's not clear how Bitcoin could respond to such an attack, but changing the mining algorithm (to make the attacker's ASICs worthless) is probably a non-starter as it would also make all the Bitcoin miners' investments in ASICs worthless as well.


Why not every [x,y] coordinate on the Secp256k1 curve corresponds to a valid uncompressed publicKey? First, some background.

1. There are some coordinates x,y satisfying y^2(mod p)=x^3+7(mod p) on the Secp256k1 curve that do not correspond to a valid Bitcoin uncompressed publicKey of the form 04[x,y].

We can prove 1 using the random_point() function in Sage with unknown generator underE=EllipticCurve(GF(modi), [0,7]). If we get lucky, after a few trials Sage returns a point such as Q.

   Q=E.random_point()

   Q
   (B8F0170E293FCC9291BEE2665E9CA9B25D3B11810ED68D9EA0CB440D7064E4DA :
    691AA44502212591132AA6F27582B78F9976998DE355C4EE5960DB05AC0A2A3 : 1)

Now we have:

   Qx=B8F0170E293FCC9291BEE2665E9CA9B25D3B11810ED68D9EA0CB440D7064E4DA
   Qy=691AA44502212591132AA6F27582B78F9976998DE355C4EE5960DB05AC0A2A3

We verify that Qy^2(mod p) = Qx^3+7 (mod p) is satisfied so we confirm that Q is a point on the Secp256k1 curve.

Next, we try to validate Q as an uncompressed Bitcoin publicKey:

04B8F0170E293FCC9291BEE2665E9CA9B25D3B11810ED68D9EA0CB440D7064E4DA691AA44502212591132AA6F27582B78F9976998DE355C4EE5960DB05AC0A2A3

We get: Q is not a valid publicKey.

Yet, checking the validity of the mirrored point -Q, returns a valid publicKey:

   -Qx=B8F0170E293FCC9291BEE2665E9CA9B25D3B11810ED68D9EA0CB440D7064E4DA
   -Qy=F96E55BBAFDDEDA6EECD5590D8A7D4870668966721CAA3B11A69F24EA53F598C

Valid publicKey for -Q:

04B8F0170E293FCC9291BEE2665E9CA9B25D3B11810ED68D9EA0CB440D7064E4DAF96E55BBAFDDEDA6EECD5590D8A7D4870668966721CAA3B11A69F24EA53F598C

Valid publicKey for -Q (hashed):

1A2gaiiKy91Pmx8EUcbT4Hd6JFZ3sQvUhM

Question:

Why not every [x,y] coordinate on the Secp256k1 curve corresponds to a valid uncompressed publicKey?

Note:

In this question, by validity I mean a set of EC coordinates (x,y) that can be hashed into a bitcoin uncompressed address. I am specifying uncompressed for obvious reasons. My question is detailed enough I hope to show that it's not referring to compressed Bitcoin addresses.

Both are valid public keys just that in the first case the uncompressed public key is not represented in a valid hexadecimal format. If you look closely, your Qy has 63 hexadecimal digits (so there is a 'half-byte'). Although hashing can be done in bit boundaries, most standard implementations out there do not support it.  Just try to concatenate '0' at the start of the Qy to get Qy = 0691AA44502212591132AA6F27582B78F9976998DE355C4EE5960DB05AC0A2A3 so that you get a full byte. So now your uncompressed public key is 04B8F0170E293FCC9291BEE2665E9CA9B25D3B11810ED68D9EA0CB440D7064E4DA0691AA44502212591132AA6F27582B78F9976998DE355C4EE5960DB05AC0A2A3, which would hash to P2PKH address: 17Y1XJiC72f2kyJnzwBdkaPQEGgaD1aroR


Can two bitcoin transactions from a Segwit address (p2sh-p2wpkh) have a reused R value? Good day.

I'd found these two transactions:

https://www.blockchain.com/es/btc/tx/2b08d658045724aba40b58690ad84ec2af1f01ab58df37387dadd2b27789f44c

and

https://www.blockchain.com/es/btc/tx/5b51729c75794a5c6ea3c016923bc587895a0b790c4aea50d8bce8d472e5aa03

They're related to the SegWit address 3AQ4kUjQaDjCjmDh2ojKEHjUKTSi52UUqD.

I don't understand much about SegWit addresses transactions but it looks like the first part of each transaction has the same R Value 145d3cbed9f338b82667f410340fcb9bf401c7e837e9f4539b915fb8bced (if this is the R value).

Is that address private key compromised?

I readed something about using the same R value can be used to get the private key of an address.
(Even with the same R value used in transactions from different addresses, but only if you already know the private key of one of those, with something like k = ( digest + r * privkey ) / s or so, I didn't found more about this case).

Segwit does not use a different signature algorithm nor does it change any of the properties of a ECDSA signature. Thus if you find transactions that involve the same public keys and the same R value, then yes, the private key for that public key is revealed.

However, what you are looking at is not the R value. In fact, you are not even looking at the signature. Rather you are looking at part of the redeemScript. 145d3cbed9f338b82667f410340fcb9bf401c7e837e9f4539b915fb8bced is part of the hash of the witnessScript, not part of a signature.

The address 3AQ4kUjQaDjCjmDh2ojKEHjUKTSi52UUqD is a P2SH-P2WSH address. This means that it maps to a Pay to Script Hash (P2SH) output script, which has a redeemScript for a Pay to Witness Script Hash (P2WSH) script. The P2WSH script contains the hash of the witnessScript, which, in this case, is a multisig script.


Discovering Bitcoin network topology For a research I am doing I would love to have a graph with the network of reachable Bitcoin nodes. Active reachable nodes can be extracted by using getaddr messages (e.g. bitnodes project). However direct inbound/outbounds connections cannot be discovered at least you have access to the node and you can run the RPC command getpeerinfo.

Is there any way to get a detailed graph of the network?

No, due to different reasons.

First, the network is always in flux, nodes are appearing and disappearing, and connections are even more dynamic, so even if there were an API you could use to ask a node for its connections, that information would be outdated quickly.

Second, privacy is part of the reason why crypto currencies exist. Divulging the list of peers of every node would run counter to this goal, so node software would be ill-designed if it provided such an interface.


Are there any countries which currently block or plan to block Bitcoin? Are there any countries which currently block or plan to block Bitcoin? If anyone has enough reputation to edit this, maybe add "censorship" or maybe "freedom" as a tag because i can't.

It seems that Charles Schumer (D-NY) and Joe Manchin (D-WV) of the U.S. senate sought a law criminalizing it back in 2011. Guess the media moved on and the law stalled.

There are also countries like Venezuela, which criminalize exchange of a 'foreign currency', under the Foreign Exchange Crime Act. Essentially, this is so they can pretend that bolivars are worth more than they really are.

Now, is bitcoin a 'foreign currency'?

  “Foreign Currency:  Any currency, whether in coins, bank notes, bank checks and in any form, other than the bolivar, the latter being understood to be the legal tender in the Bolivarian Republic of Venezuela, as well as securities denominated in foreign currency or that can be settled in foreign currency.”

Technically, yes.

Source


Building a web app to collect Bitcoin payments. How should I monitor transactions on payment? I'm looking to create a web app similar to coffee.foldapp.com where they load up a bitcoin address and once you pay it will automatically show the Digital code product. They seem to be using 0-confirmation. I heard it was risky, but why are they doing it then?

I'd like to do the same approach since my digital items aren't super expensive and have the option for zero confirmation.

What are some ways to do this? Does the client browser have to constantly ping the server to get a payment status update? Or does the server push it to the client's browser?

I'm planning to do this in PHP if its even possible. Or can I just do it without PHP and just tap into API's of other sites like blockchain.info?

I'm looking to create a web app similar to coffee.foldapp.com where they load up a bitcoin address and once you pay it will automatically show the Digital code product. They seem to be using 0-confirmation. I heard it was risky, but why are they doing it then?

It is risky since you accept the transaction without it being in the blockchain. See the accepted answer to this question for a double spend example: as mentioned in the comments it is still difficult to work. This question is related. Merchants are doing it because they are willing to accept the risk for small value transactions. You will hear several percentages on the risk factor but it is generally low. Some examples here and here.

  I'd like to do the same approach since my digital items aren't super expensive and have the option for zero confirmation.

Super expensive is relative.

  What are some ways to do this? Does the client browser have to constantly ping the server to get a payment status update? Or does the server push it to the client's browser?

The server pushing to the client is the way to go from an engineering perspective.

  I'm planning to do this in PHP if its even possible. Or can I just do it without PHP and just tap into API's of other sites like blockchain.info?

Even if you don't use your own node (or other people nodes) directly and want to use the API of a site you will still need to program it in some language. For example, the blockchain.info site has an API library for PHP.


Does ASIC miners leave a trace in the mining history of bitcoin? I have a research interest in understanding the spread of innovation, and the adoption of ASIC machines in the Bitcoin mining community is particularly relevant.

Does ASIC machines typically leave a trace in the blocks that they mined? Would a particular type of machine leave such trace/record/identifier in the transaction record?

No. ASICs do only hash calculation. All data in block (except nonce) is defined by pool/node software


Can Undercutting attacks be Mitigated? An Undercutting attack as described in this paper, is a mining strategy which involves producing new blocks not on the longest known chain, but instead 'undercutting' the longest chain by building a block, which collects less of the available transactions' fees, on a shorter chain. This behavior creates a direct incentive for another miner to now build new blocks on the 'undercutting' chain as there exist a higher sum of transactions' fees for them to collect.

In the paper, the authors describe how this can lead to a situation in which a 51% attack can be successfully carried out with less than 51% of the hashing power of the network. This is enabled due to the undercutters orphaning blocks and lowering the effective hashing power of the network (the 51% attackers have an advantage as they needn't orphan their own blocks, but the honest or undercutting miners work at a cumulatively lower hash rate due to the potential orphaning of higher value blocks).

Are there any solutions which disincentivize Undercutting behavior? Or, can the behavior be mitigated through a change to the protocol?

1. You will never be able to re-mine the previous block and get more fees.
Since Bitcoin Core 0.11.0 (July 2015) transactions include a nLockTime to discourage fee sniping and ensure they can only be mined at a height greater than current head. Their fees can only be collected by moving forward and not by undercutting previous block. Although adoption is not widespread, you can expect it to be if this threat became credible. Also, a chain leaving less fees for the next miner will be less attractive for other miners to continue.
This would be the opposite case to the attack described in the mentioned paper, which consists on re-mining a block to claim less fees and incentivize other miners to continue it instead of the honest one.
2. Mempool will not be shallow enough for consecutive blocks to have significantly different reward.
Marginal utility of transactions decreases as fees get more expensive, so Bitcoin users face a trade-off between waiting a bit longer for block inclusion (until congestion subsides) or pay higher fees.
We can observe that the more transactions are queued in the mempool, the higher and flatter is the fee slope, and the lower will be the difference between contiguous block rewards. This is due to abnormally high fees of high priority transactions published between blocks (that heap on the left of the charts) representing a smaller fraction of the total reward.
Check the clear cut at 250 sat/WU for most transactions of December 22, 2017. Most people is not in such a hurry for transaction confirmation after all when fees become significantly high, and they will be willing to pay little more for their transactions to be mined in 6 hours time instead of 7 hours.

Rewards immediately after a block is found are certainly NOT zero, "making it unprofitable for any miner to mine", as they claim.
3. Miners can always hedge undercutting risk.
Miners could include an anyone-can-spend output in their blocks, as a premium to mitigate the risk of other miners undercutting them, when their rewards are much more valuable than the fees remaining in the mempool. So, there is no need to alter transaction selection to make this possible.


why bip 34 uses two step on MASF(Miner Activated Soft Fork)? in bip 34, which change to bitcoin version 1 -> 2, uses two step for network's consensus.

step 1. check if 750 of the last 1000 blocks are version 2 or greater.
step 2. check if 950 of the last 1000 blocks are version 2 or greater.

but in my opinion, step 1 is useless process in consensus step.
we just need :
check if 950 of the last 1000 blocks are version 2 or greater.
 if blocks < 950 :
   if block_height_limit > current_height :
     accept()
 if blocks > 950 :
     return accept_new_version();
     drop version_1_block

why step 1 is needed on MASF step?

The two thresholds enable two different rules.

If more than 750 of the last 1000 blocks are version 2, the network starts enforcing BIP34 - at this point, blocks that claim to be version 2 but do not comply with the requirements outlined in BIP34 are rejected. Version 1 blocks continue to be accepted.

Once more than 950 of the last 1000 blocks are valid version 2 blocks, all new version 1 blocks are deemed invalid.

This allows for a mostly graceful transition, and gives miners time to upgrade their systems in a rolling manner as opposed to requiring everyone to update at the same moment.


What is the composition of transaction types in current blocks? What types of transactions do we see in blocks today and how much of the blockspace do they occupy?

I.e. does someone have data how much of the blocks are Pay to PubKey Hash, Pay to PubKey, Pay to Script Hash,…?

I've found A survey of Bitcoin Transaction Types, but it's from April 2014 and outdated.

I recently had the same question and made a small script to compute it (using this python library). Here you have a cumulative plot showing the number of transaction outputs of each kind over time:


What percentage of Twitch tipping now occurs with Bitcoin? How does Bitcoin tipping compare to PayPal? Are there projections for when cryptocurrency tipping will surpass PayPal for revenue on the platform?

Unfortunately this is something only Twitch could publish.

They don't even mention Bitcoin in their 2015 Retrospective, but maybe they will for the 2016 one.


How can I import my BitGo wallet backup into Electrum? I went through several similar question poster previously, but couldn't figure out what the issue is. A year ago, I had generated a paper wallet. I am not sure how I can sweep it to my electrum wallet.

On the paper wallet, I have the following values:

Backup Key
Encrypted wallet password
Bitgo public key
User key

Electrum, on the other hand, is asking for Private Keys. Am not sure what it is.

Disclosure: I'm a software engineer at BitGo.

Most paper wallets store a single private key and this is what you can easily import with most wallets.

However, it seems that you're holding the recovery sheet for a BitGo wallet. BitGo wallets are based on a 2-of-3 multisignature setup: BitGo holds only one key while the user holds their private key and the backup key is either held by the user or a key recovery service. This way, BitGo never is in control of the users' money, but can provide wallet services and effectuate the policies set by the users.

I would be surprised if Electrum had support to import a multisignature setup off the cuff. ;)

If you've lost access to your BitGo account, you can use the account recovery on our website. If you don't remember your email address either, you can use our Wallet Recovery Tool to sweep the wallet content to a destination address of your choice. To move the funds to your Electrum wallet, you could put one of your receive addresses from Electrum as the destination in the recovery tool.


On Cryptowatch (or equivalent): see percentage change to custom reference point Given that I bought a certain amount of BTC at a given point in time. Is there a way on cryptowat.ch or an equivalent platform, to mark the price and point of time at which I bought the BTCs and get information about how the current price is to the reference price in percent (preferably live)?

Not the way you are putting it but i update my portfolio on
https://www.worldcoinindex.com/portfolio

This allows me to see in euro/usd and others.
For example you bought 1000 usd of any combination of currencies.
This profile wil tell you what it's worth approx (different markets have slight changes between them).


Unconfirmed Transaction disappeared when I pressed "repair wallet" I bought some bitcoins and send them to an a receiving address on Multibit HD, It has been maybe 3 or 4 hours without any confirmations, so I decided to press "repair wallet", which said it would resynchronize etc.

Now the "+Unconfirmed transaction" bit isn't even showing anymore and it isn't in the payments section. Here is the bitcoin transaction:

https://btc.blockr.io/tx/info/111df2572b8550724c78f30bf70f4cafee61417924058fdd624adb172968637a

That transaction looks fine so try the Tools | Repair wallet again to see if it appears.

If that does not work then you can 'clone' your wallet in Lighthouse using your wallet words and see if it appears in that.

Lighthouse and MultiBit HD use the wallet words in the same way.
https://www.vinumeris.com/lighthouse


How can I use the blockchain API? The blockchain is not designed in a way where you can easily get information correct? You have to know more than python basics and have good programming skills as their seems to be no API, and no methods of just querying the data to get basic stats such as "latest transaction" or "biggest transaction ever"....

Actually, the BlochChain API is pretty good and Ben Reeves has done a nice work implementing it. And for the most part, for free. You only have to know how to send HTTP requests from your code, and parse the Json your app receives. If you think his API is not complete or unworking, do it yourself and make him competition ;-)

An API is designed for programmers, not simple users. What do you want to do exactly?


sendtoaddress command doesn't work with bech32 bitcoin core 0.17 I have bitcoin-core 0.17 working on regtest mode and when I try to send to a bech32 testnet address I get invalid address

I have set addresstype=bech32 on my bitcoin.conf

It sounds like you are using the wrong address type for the network that you are on. Regtest bech32 addresses begin with "bcrt".


My BTC is taking way too long to transfer I earned 0.4 BTC from constant mining. (I use 50BTC). So I clicked payout, and sent them all to my BlockChain account. It's been "In Process" for about 1 day. What's the problem here? Does it usually take this long? Is it because they got hacked recently?

How can I get these BTC to transfer? By the way, the BTC was removed from the 50BTC account, but it's not yet in the BlockChain. Is it suppose to do this?

Thanks.

Sorry for being a noob, it's my first time with BTC.

Is the transaction showing on blockchain.info as unconfirmed, or not there at all?

If it's unconfirmed, just wait as it may be that the transaction included no or a minimal transaction fee which means it will take a while to be included in a block.


Are bitcoin exchanges all connected to each others? or just close platform I wonder these exchanges, e.g. mtgox , bitstamp, bitcoinChina...etc, are they using API to connect to each others?

or they just closed exchange, the price sync are from the free market?

Prices are determined by free market forces. The free market prices coins different on each exchange due to liquidity, fees, fiat conversion options, and terms. Prices follow similar patterns over time, but it is traders that determine what the price is.


Bitcoinjs-lib help with deterministc wallet i'm learning about bitcoin, and bitcoinjs-lib (https://github.com/bitcoinjs/bitcoinjs-lib)

I created a dummy wallet on coinomi using this mnemonic ('eight better wealth display father cave suffer game sign health fit exchange noble tunnel poet remember owner letter submit illness cage calm dry noble')

and i'm trying to generate a Deterministic wallet with it.

Here is my code

  const bip39 = require('bip39')
  const bip32 = require('bip32')
  const bitcoin = require('bitcoinjs-lib')
  const network = bitcoin.networks.bitcoin;
  function getAddress (node) {
  return bitcoin.payments.p2pkh({ pubkey: node.publicKey, network}).address
  }
  const mnemonic = 'eight better wealth display father cave suffer game
  sign health fit exchange noble tunnel poet remember owner letter
  submit illness cage calm dry noble'
  console.log('Testing mnemonic: ',bip39.validateMnemonic(mnemonic))
  const seed = bip39.mnemonicToSeed(mnemonic)
  const root = bip32.fromSeed(seed)
  console.log("m/0'/0/1 ->",getAddress(root.derivePath("m/0'/0/1")));
  console.log("m/0'/0/2 ->",getAddress(root.derivePath("m/0'/0/2")));

.

and this is the output that i got

.

  Testing mnemonic: true
  m/0'/0/1 -> 17tdSW83Vjw23TdQsmZDtBAupan9WiGGd5
  m/0'/0/2 -> 17bYSjEXwZxMgVkRRt9pJgDgExiX8Xht3b

Then I go to (https://www.coinomi.com/recovery-phrase-tool.html) to test if my results are correct, and it isn't, could someone help me with this please. How to fix the code?

It looks like it is working. Go to https://www.coinomi.com/recovery-phrase-tool.html and make sure to enter the following:

BIP39 Recovery Phrase : eight better wealth display father cave suffer game sign health fit exchange noble tunnel poet remember owner letter submit illness cage calm dry noble

Coin : Bitcoin

BIP32 Derivation Path (In BIP32 Tab): m/0'/0

Result:

Derived Addresses

m/0'/0/0`   169zFhK1WTuxfhgY6bmzE9zP1godCfZr2V
m/0'/0/1    17tdSW83Vjw23TdQsmZDtBAupan9WiGGd5
m/0'/0/2    17bYSjEXwZxMgVkRRt9pJgDgExiX8Xht3b


Is there a way to figure out when an address is created? I'm doing some bitcoin address collections. If there are some meaningful letters in the address or if the address is created in a meaningful time to me, I will buy it.

How can I know when the address is created?

Addresses are not created, per se. They're simply a representation of a public key. So, you cannot know when an address is "created."

However, it is possible to know the first time an address is used.


Why do I get `bitcoind: command not found` in Ubuntu? I have built the bitcoin source on my Ubuntu desktop, and have installed the proper libraries via apt-get and building some.

When I do:

cd src
bitcoind -daemon

I get the error:

bitcoind: command not found

and when I do ./bitcoin I get:

bash: ./bitcoin: No such file or directory

What am I doing wrong?

Go to the directory with the bitcoind binary.

Make sure it's executable:
chmod +x bitcoind

Now run it:
./bitcoind -daemon


Can a bitcoin address be duplicated? I'm new to this site. A few years ago I got a bitcoin wallet address but honestly never did anything after that but think there is a few dollars

Unless you have the private key or seed words leading to that address saved somewhere, there is no feasible way to recreate it.


How did ghash.io fall? Years ago, GHash.io had claim of 40% of the network hashpower. They were close to 51%, where they would have the power to initiate a 51% attack. Now it has 0.2%. How did this happen?

Apparently they were hit with a massive denial of service attack in response to their growing hash rate. That combined with a subsequent drop in the price lead them to stop their cloud mining operation and focus on their exchange (cex.io).

The other non cloud-miners who left the pool most likely did it in response to the massive appeal from the community to find another pool.


How To Transfer Coins From Bitcoin Core to Electrum to avoid Sync Process? I am super new to bitcoin and to be honest am not sure what I'm doing. I needed to buy something via bitcoin, and its recommendation was to download Bitcoin Core Wallet, so I did that and bought bitcoin to the receiving address on there, however I didn't know how much space was needed. So now I have sent the money to my Bitcoin Core address, but the wallet is trying to sync (and its taking forever which apparently is normal) and I'm not even sure my computer has enough space for it all. I read that I should try to transfer it over to Electrum, so I have that downloaded. I tried doing the Sweep Keys thing, but every time I try it, it says "no inputs found (note that input needs to be confirmed)"

Can anybody give me a hand here? I unfortunately will need pretty specific instructions..
Thanks :)

To relieve your space problem, You could either run it on an external drive, or run Bitcoin Core under prune mode. Depending on your OS, you'd need to find a file called bitcoin.conf, modify that, and restart your Bitcoin Core Wallet process. The file would look something like this

The line for prune mode reads

# Enable pruning to reduce storage requirements by deleting old blocks.
# This mode is incompatible with -txindex and -rescan.
# 0 = default (no pruning).
# 1 = allows manual pruning via RPC.
# >=550 = target to stay under in MiB.
prune=550 <- change this number if needed

Electrum is a light-weight wallet that relied on trusted nodes for transaction information. This page explains the steps needed to migrate from Bitcoin core to Electrum. According to that, you'd need to dump your private key from Bitcoin core and sweep that into Electrum.


Two question about bitcoin transaction signing I know that the signing should use public key, what if the private key is used in signing the output? Does that mean anybody can use the money in your wallet? And is there any difference between P2PKH and P2SH?

Signing requires the private key, and commits the signature hash of the transaction to the signature. Altering the transaction will change the sighash, and thereby render the signature void.

The public key is required for signature validation. Only the public key hash is shared with the public in form of the address, from which the private key cannot be derived.

P2PKH and P2SH are both standard output scripts in Bitcoin.

A P2PKH(address) output is spendable by the private key associated with the address.
A P2SH(embedded_script) output is spendable by the embedded script and the unlocking script thereof. The P2SH output script acts as a "wrapper" for other output scripts.


What is a Buy as opposed to a Sell? What defines a Buy vs a Sell record in the trading time series of an exchange? In any trade there is always someone selling and someone buying... So what defines a particular trade as Buy or Sell?

It is from the perspective of the other person (not yours).

When you see Sell, or Sell Orders or Selling or Asks is people willing to sell to you. Thus you look at these entries if you are buying.

When you see Buy, or Buy Orders or Buying or Bids is people willing to buy from you. Thus you look at these entries if you are selling.


Proper getmemorypool data endianness? As there are a couple endiannesses used by Bitcoin, what is the proper way to encode the data parameter for a getmemorypool JSON API call?

The "data" is not a number (only numbers have endian issues), but the raw byte data of a valid block. You may wish to read over BIP 22, which is the Draft-status standard detailing the getmemorypool protocol.


Can the coinbase transaction be used to spend an UTXO? I know the coinbase transaction's input is usually just has a dummy scriptSig, but what if a miner used it to spend an UTXO? Would it be verified as an actual spend, or would the block be rejected?

It would be rejected.  The coinbase input must use a very specific previous outpoint: 0x0000000000000000000000000000000000000000000000000000000000000000ffffffff. This prevents it from referring to an actual previous outpoint.


Where to stop key derivation when looking at balance of a deterministic wallet If I want to know the total balance in all the addresses which can be generated in a deterministic wallet (like electrum or armory).

I have the master public key allowing me to derive an infinite number of public keys.

What is the number of addresses I should generate to check the balance ?

I suppose I can stop if the last X addresses don't have any transactions.

What is the value of X for electrum and armory (when recovering from a backup) ?

The gap limit is the maximum number of consecutive unused addresses in your deterministic sequence of addresses. Electrum uses a gap limit to stop looking for addresses, it is set to 5 by default, so the client get all addresses until 5 unused addresses are found.

https://electrum.org/faq.html#gap-limit

If you used a different gap limit when creating the addresses, then you need to keep record of it or remember it. Addresses that appeared beyond the gap limit won't be found unless you set the gap limit you used.

For example: Using MPK on a web server you used gap limit 40 to create 40 addresses for your web store. Then you had 39 open orders that are not paid and the address number 40 has a payment.

When you restore with gap limit 5 (default in the client) you'll have 5 unused empty addresses, you won't see the other 34 that are also unused but related to open orders neither you'll see or have balance for the address number 40 that has a payment on it.


What is most efficient way to validate bitcoin target (difficulty) value in C++ I have two values

1. h = hash of the block (32 bytes long in memory representation - not hex)
2. bits (uint32_t)

To make the calculation easier we create a function difficulty such that:

auto d = difficulty(bits)

Now what is the best way to create such a difficulty function that, I believe should, return a 256 bit value?

Then I am thinking casting both h and d values into an array of type uint64_t and compare all 4 elements from msb (bit 255) to make sure the condition holds.

Is there a better way for comparing as well?

Bitcoin Core has its own arith_uint256 class for calculations on 256-bit unsigned integers.  Its code to convert "bits" (so-called compact format) to arith_uint256 can be found in arith_uint256::SetCompact in the file arith_uint256.cpp.

So you could always just use its code directly.  This might be a good idea because if your version differs in any way from their behavior (e.g. rounding errors), you could disagree with Bitcoin Core on the validity of a block.  If your version is in a widely-used client, this would fork the block chain.


How to make ImportMulti function like ImportAddress for watch-only addresses placed into Accounts? My question is: I want to use ImportMulti to import a long list of watch-only addresses.  However, unlike ImportAddress, I don't see any way to place these addresses into specific "accounts".  Is this even possible?

UPDATE: After more research, it seems to me that the concept of "label" is basically the same thing as "account".  Is this correct? Seems kind of confusing to me. If this is the case, then ImportMulti can work as I want, by using the "label" property.

After doing some RPC function call tests with ImportMulti and ImportAddress, I feel confident answering my own question.

By way of example, suppose I want to import a watch-only address "1CxZZZREDACTEDYYYYREDACTEDxyzabcD1":

Using "ImportAddress":

bitcoin-cli importaddress  1CxZZZREDACTEDYYYYREDACTEDxyzabcD1 "Account XYZ" true

Using "ImportMulti":

bitcoin-cli importmulti '
  [
    {
      "scriptPubKey" : { "address": "1CxZZZREDACTEDYYYYREDACTEDxyzabcD1" },
      "timestamp" : 1510387200,
      "label" : "Account XYZ"
    }
  ]' '{ "rescan": true }'

Lessons Learned:

Label vs Account:
The "account" parameter in ImportAddress has the same effect as the "label" property in ImportMulti.  They both just label the bitcoin address with friendly text (in my case, "Account XYZ").

Rescan and timestamp:
If you set "rescan" to true in ImportAddress, then it will rescan the entire blockchain from the beginning.  However, if you set "rescan" to true using ImportMulti, then it will only rescan as far back as the earliest "timestamp" value in your list of JSON-encoded address objects. Note that I used the following Linux command to generate my timestamp value of 1510387200:

$ date -d "Nov 11 2017" +%s
$ 1510387200

Summary:

You can use ImportMulti to perform the same operation as ImportAddress, knowing that in ImportMulti, the "label" property of each Import object means the same thing as the "account" parameter in ImportAddress. Further, ImportMulti is more powerful because you can specify each address's creation timestamp, which results in a much faster "rescan".

If anything I wrote here is wrong, please correct me.


Does a miner (or mining pool) who has 10x as much hashing power have 10x the odds of mining a block? I heard somewhere that joining a mining pool logarithmically increases your odds of mining a block.. is that for some reason true?  Or was it someone who didn't know what they were talking about and it would be be a linear increase in the likely hood of mining a block?

Each hash you do has a certain chance to successfully mine a block. Do twice as many hashes, and you have twice as many chances to mine a block.


Tie Breaker to reduce orphaned chains? When two different miners find the same block number at roughly the same time, the chain is forked, and there is a bit of a race to develop a longer chain, leaving the alternative orphaned.

Why is there this type of race instead of a tie-breaker among the two competing blocks?

A simple tie-breaker would be:

"the block with the smaller nonce wins, and the block with the larger nonce should be orphaned immediately".

Does the competition among competing pools offer some advantage I'm not seeing?

Consensus rules are often a lot more delicate than they might first appear. Having a tie breaker can actually enable attacks.

If I find a block with a really low nonce, I can gamble to keep it secret and then only when a competing block is found, I can simply neutralize it by broadcasting my low-nonce block. This makes other miners waste their time on a block that will never become part of the chain and it gives me a better chance of finding the next block myself.

I'm not sure if this is true for all possible tie breakers. At least not to the same degree.

The answer by @hedgedandlevered looks at the question from another perspective ("What use would a tie breaker have for the system as a whole?") and is probably generally correct (that is: little to nothing).

However: another example of a tie breaker might be where SegWit signaling blocks are treated preferentially during a tie. That would (assuming support is already > 50%) increase the likelihood of SegWit activating a little as well as providing a slight monetary incentive for (all) miners to activate SegWit. This can be seen as an advantage to the system as a whole and as far as I know does enable attacks by miners in the way the nonce example did.


Account change address is not showing up with `getaddressesbyaccount` I have a tiny question regarding the Bitcoin JSON-RPC API. I have a transaction on Testnet which sends one coin to an other address owned by me (on an other account than the sender). The sending address, mtGaEd9zZU8B7aYSuQiDFZTo2wiS8dWb3c, is listed under the default account, running getaccount mtGaEd9zZU8B7aYSuQiDFZTo2wiS8dWb3c outputs indeed an empty string. The receiving address, mzcj8xYome3gmAWZG57yutv14sctPxbPV6, is listed under an account named test, as expected running getaccount mzcj8xYome3gmAWZG57yutv14sctPxbPV6 returns test. Both addresses also show up when I use getaddressesbyaccount, but the change that went to address mnUJRd9CL3GV1QbWFxJxLj2DgE1ADSB8oR, which also returns an emtpy string when using it as argument to getaccount, doesn't show up in the getaddressesbyaccount call output. Why is that? I can't sum the balances of each addresses now for a reliable account balance, only getbalance return the right answer.

Call listreceivedbyaddress(0, true) to get all of your addresses (even the empty ones or those who have a zero-confirmations balance).

By default (parameterless) it will only list the addresses that contain some confirmed balance and those who have at least one confirmation for their unconfirmed balance.


Bitcoin core wallet's security When running a bitcoin node on an enterprise level: a lot of addresses will be generated with getaddress RPC for users to send their funds to. As far as I understand, these addresses, as well as the private keys for them, are all stored somewhere in the datadir. The whole key tree, as well as the seed key, can be dumped through rpc. Are there any rules of thumb to secure these keys from being dumped by unauthorized people? Are there any scalability problems with having too many keys stored in bitcoin core? Any other rules according to private keys and business set up?

All addresses and their corresponding private and public keys are stored in the wallet.dat file in the data directory. Assuming your Bitcoin Core is running on a machine which has access to many people but you want to prevent unauthorized persons from dumping the wallet on that shared machine, the best way I can think of is that you can encrypt your wallet with a passphrase. When they run the dumpwallet command, the private keys that are dumped will be encrypted.

When you want to get the unencrypted private keys you can run the command walletpassphrase <passphrase> <time to unlock in seconds> and then run the dumpwallet command.

However, using an online connected wallet for storing large number of bitcoins is not recommended as there always will be a weak point which can be exploited. You could run two Bitcoin core, one online and other offline. With the current Bitcoin Core, you create a wallet on your offline machine. Using it, you get one or more addresses (saving them, for example, to a text file). You copy those addresses to your online computer and give them to people to pay you. When you want to spend those payments, you create the transaction on the online computer in an unsigned form, copy it to your offline computer, verify it, sign it, copy the signed transaction back to the online computer, and send it. You can use the watch only functionality in the online Bitcoin Core wallet by importing the addresses using importaddress command.

EDIT for Bitcoin Core v0.18. The latest release of Bitcoin Core v0.18 supports hardware wallet integration to allow command line management of several hardware wallets including Trezor Model T, Trezor One, Ledger Nano, Digital BitBox, KeepKey and ColdCard. This would allow you to get the same security of a hardware cold wallet but with added functionality of relying on your full node rather than the SPV node of the wallet. For more information refer Using Bitcoin Core with Hardware Wallets on GitHub.


Can bitcoin-core wallet be used as the backend for a mobile wallet app? my idea is to use bitcoin core and it's multi-wallet capabilities as the back-end of a mobile wallet app. The way I think this could be archieved is by creating an empty wallet with bitcoin-cli createwallet true and then using the importmulti RPC command to upload an output descriptor with an xpub.
Disregarding the privacy issues, the only other thing that worries me about this is that some wallets might cause the node to re-scan the blockchain, and since this can potentially take a while, all other clients will be basically denied their service.
I have not really tested this, but I'm pretty sure this will prevent this architecture from ever working. Am I right? or is there a way around this?

There are at least two open source mobile wallets that already do just this:
FullyNoded for iOS, which connects to a bitcoin node via a Tor V3 Hidden Service
Sifir which uses the brilliant Cyphernode


Generating a segwit (bc1) address from a brain wallet? Are there any brain wallet generators that can generate segwit (bc1) addresses yet?

Here's an example with bitcoinjs-lib:

let bitcoin = require('bitcoinjs-lib');
let assert = require('assert')
let bigi = require('bigi')

let NETWORK = bitcoin.networks.bitcoin;
let brainwallet = "This is my brain wallet and it is less secure than a CSPRNG source";
let hash = bitcoin.crypto.sha256(brainwallet);
let d = bigi.fromBuffer(hash);
let nkeyp = new bitcoin.ECPair(d);
let wif = nkeyp.toWIF();
let pubKey = nkeyp.getPublicKeyBuffer();
let scriptPubKey = bitcoin.script.witnessPubKeyHash.output.encode(bitcoin.crypto.hash160(pubKey))
let address = bitcoin.address.fromOutputScript(scriptPubKey);
console.log(address);
console.log(wif);


Is it possible to send bitcoins without paying a fee? I am using the 0.4.0 release. Is it possible to send bitcoins without paying a fee?
Who gets the fee ? Is it only miners discovering new blocks?

It is possible to send Bitcoins without paying any fee. The easiest way is if your transaction meets the following requirements:

The transaction only sends coins to one address, plus the return of change. (No more than two 'out' scripts.)
The transaction doesn't need to gather a large number of small transaction outputs. (You are spending funds you received in a sensible way, not as a large number of micro-transactions.)
The funds are stable. That is, you aren't spending funds you recently received.

Otherwise, the transaction fee goes to the miner who includes your transaction in a block.

Currently, it is possible to get any valid, standard transaction into a block without paying a fee if you are willing to be sufficiently patient. You may need to specifically configure your client to connect to a client known to accept such transactions and known to relay them to miners. (Luke Dash Jr. runs one such node, with IP address 173.242.112.53.)


Multiple input/output transactions using golang btcd I am using golang's btcd as a basis for creating some server-side tools for handling transactions. I found a good example for creating a basic one-input-one-output transaction to get me started on the implementation, and I have also read the documentation heavily on the technical specifics here.  I have also looked at the other btcsuite libraries pretty heavily to try to gain more insight. To be clear, I am NOT expecting any of these tools to issue the transaction or anything like that; I understand that this was written out of btcd in particular for very, very good reasons. I am just trying to use these tools to create valid transactions that I can issue later.

I am still incredibly confused on the particulars in implementing multiple input, multiple output transactions and the scripts that we use on them.  A few topics:

I'm familiar with the script tools in btcd, the link goes to the most common one used, but all of these scripts are used for one specific output. There seems to be absolutely no documentation anywhere about how to provide scripting for multiple outputs. If I'm doing a normal P2PK or P2PKH transaction, do I simply concatenate the scripts for all the various outputs, or what?
In the create Transaction example in the HelloBitcoin example I've linked above, the overall magic happens near the end with:

buffer.Write(version)
buffer.Write(inputs)
buffer.Write(inputTransactionBytesReversed)
buffer.Write(outputIndexBytes)
buffer.WriteByte(byte(scriptSigLength))
buffer.Write(scriptSig)
buffer.Write(sequence)
buffer.Write(numOutputs)
buffer.Write(satoshiBytes)
buffer.WriteByte(byte(scriptPubKeyLength))
buffer.Write(scriptPubKey)
buffer.Write(lockTimeField)

And I feel like there are a lot of unanswered questions on how to expand this to handle multiple inputs and multiple outputs. For the inputs, is it as simple as taking all the input transactions into little-endian, noting the correct number in inputs, and going from there? For outputs, do you just have an individual block of to satoshiBytes to scriptPubKey? I can't find in the documentation  how this is supposed to all glue together, and at this point I feel like I need some help with the nuts and bolts of this. Thanks in advance for any help - if we can get these two points answered I might end up making more questions from the stuff that will inevitably result from this.

There might not be an easy answer, but the developper documentation is probably a first stop (https://bitcoin.org/en/developer-examples#complex-raw-transaction). Also I used regularily a block explorer (e.g. blockchain.info) to display the transaction and also its "raw" format. This allows to see the tx details in it's JSON format. Also the book from Andreas helped alot (Mastering Bitcoin). And finally there is also this forum here (the search function is good), and bitcointalk.org. Oh, then there is the wiki as well: https://en.bitcoin.it/wiki/Protocol_documentation#tx.

  For the inputs, is it as simple as taking all the input transactions
  into little-endian, noting the correct number in inputs, and going
  from there?

No, I don't think so. There is no such thing as simple :-)
You are on the right path, additionally when assembling a raw, unsigned transaction, and you have to deal with field lengths, and with "var_int", which are explained in developper docs. Here is a sample tx, so you get an idea:

VERSION                                 01000000
TX_IN COUNT [var_int]:                  hex=03, decimal=3
 TX_IN[0]
  TX_IN[0] OutPoint hash (char[32])     94FAE0AC28792796063F23F4A4BA4F977A9599D1579C5AAE7CE6DDA4F8A6B1BB
  TX_IN[0] OutPoint index (uint32_t)    hex=14040000, reversed=00000414, decimal=1044
  TX_IN[0] Script Length (var_int)      hex=19, decimal=25
  TX_IN[0] Script Sig (uchar[])         76A914A438060482FCD835754EA4518C70CC2085AF48FA88AC
  TX_IN[0] Sequence (uint32_t)          FFFFFFFF
 TX_IN[1]
  TX_IN[1] OutPoint hash (char[32])     A3E719B12275357B15FC5DECD9088A0964FE860D49F026F2152E71F681AC3FA4
  TX_IN[1] OutPoint index (uint32_t)    hex=31040000, reversed=00000431, decimal=1073
  TX_IN[1] Script Length (var_int)      hex=19, decimal=25
  TX_IN[1] Script Sig (uchar[])         76A914A438060482FCD835754EA4518C70CC2085AF48FA88AC
  TX_IN[1] Sequence (uint32_t)          FFFFFFFF
 TX_IN[2]
  TX_IN[2] OutPoint hash (char[32])     874CD4C4E1683C43A98A9DAA0926BEA37C10616F165AC35481E8181BFD449C65
  TX_IN[2] OutPoint index (uint32_t)    hex=E0010000, reversed=000001E0, decimal=480
  TX_IN[2] Script Length (var_int)      hex=19, decimal=25
  TX_IN[2] Script Sig (uchar[])         76A914A438060482FCD835754EA4518C70CC2085AF48FA88AC
  TX_IN[2] Sequence (uint32_t)          FFFFFFFF

TX_OUT COUNT                            hex=01, decimal=1
 TX_OUT[0]
  TX_OUT[0] Value (uint64_t)            hex=8038010000000000, reversed_hex=0000000000013880, dec=80000, bitcoin=0.00080000
  TX_OUT[0] PK_Script Length (var_int)  hex=19, dec=25
  TX_OUT[0] pk_script (uchar[])         76A914C2DF275D78E506E17691FD6F0C63C43D15C897FC88AC
LOCK_TIME                               00000000

  For outputs, do you just have an individual block of to satoshiBytes
  to scriptPubKey?

It is similiar to the example above, just don't have one at hand. But the majority of tx have a spend-to address, and a return address, so you might look a tx up in the block explorer...
Happy coding ! :-)


Slow sync running Bitcon full node on Mac Mini OSX It is Jul 2018, I need help after several attempts to sync a full node running on a Mac Mini.

I have tried several times and Bitcoin-qt starts pretty well for the initial sync, downloading with progress that ranges from 1% per hour up to 3 % per hour. But when sync goes around 30% (blockchain around 50 GB) sync slows down to 0.2% per hour so it'd take weeks.

HARDWARE:

1.4GHz dual-core Intel Core i5
OSX 10.13.6
500GB (5400-rpm) hard drive
RAM 4GB of 1600MHz LPDDR3 memory
Good internet speed.

SOFTWARE:

Installed Bitcoin Core implementation 0.16
I tried both, installing the .dmg for mac and also tried to homebrew
Both successful in the beginning, and then sync goes down

I get good connections, and I have the port 8333 opened so I have no clue of what is going on, whether it is problem with the hardware (mac works fine) or the implementation.

Actually I have been running Litecoin and Monero nodes in the same hardware, implementing OSX builts and those worked fine, but Bitcion Core doesn't .

I hope someone can help me, if faced the same difficulties with bitcoin.
I really would like to succeed in this and support the network

Syncing the bitcoin blockchain on lower-end hardware takes it's time. Just let it run.


How can the blockchain keep only one version of the ledger equal across all nodes Lets say miner A is working on block X, while miner B works on block Y.
Both miner A and B find the hash for their blocks almost at the same time, and as such, they start broadcasting their results to other miners, so a consensus can be reached.

Are all the miners on the network needed to reach such consensus?

If such, what happens if a group of miners is working to reach a consensus on a block, and some other group is working on some other block (given that the broadcast to every node takes a little bit of time)?

How do they decide what block gets added first to the blockchain?

Note that I'm pretty new to this, and still trying to learn how the blockchain works.

Each miner will take the first valid block they received and begin working on the next block with this as the previous one. They do not achieve any consensus on whether X or Y are the valid block at this stage, and some miners may be working on X, with others working on Y.

The tie is broken as soon as one of the miners creates block Z. If the previous block of Z is X, then the consensus is reached that X was the correct block and Y is discarded by miners who were working on it. Z now represents the longest chain and so all miners will begin working on this.

There may be several disputes in a row, and each miner will just work on the block they received first. The dispute will eventually be resolved because the probability that blocks will be mined simultaneously for several blocks in a row is very low.


Is there a market for converting my foreign currency and coin into bitcoins? I'm a coin dealer and I have large ammounts of foreign coins (Euro, British Pounds, swiss francs, Japen Yen ect..  I was wondering if I could deposit those coins into my bitcoin account/wallet?

I think that perhaps you might misunderstand what bitcoin is. If you're looking for a way to sell your physical coins for bitcoin, there are ways to do that. Perhaps bitcoin-otc.com.

If however, you're looking for some way to virtually/digitally trade your physical coins then bitcoin won't help. Depending on what you're actually trying to do, Ripple.com may be the closest digital currency system to help you, see this topic on bitcointalk.org about how one person is leveraging his stash of pre-1964 US silver dimes on Ripple.


Three different HEX having same wallet address how possible? HEX1:
1111111111111111111111111111111111111111111111111111111111111111
public key:

044f355bdcb7cc0af728ef3cceb9615d90684bb5b2ca5f859ab0f0b704075871aa385b6b1b8ead809ca67454d9683fcf2ba03456d6fe2c4abe2b07f0fbdbb2f1c1

Wallet Uncompressed:
                                    1MsHWS1BnwMc3tLE8G35UXsS58fKipzB7a

private key Wif:

5HwoXVkHoRM8sL2KmNRS217n1g8mPPBomrY7yehCuXC1115WWsh

public key compressed:

b'\x03O5[\xdc\xb7\xcc\n\xf7(\xef<\xce\xb9a]\x90hK\xb5\xb2\xca_\x85\x9a\xb0\xf0\xb7\x04\x07Xq\xaa'

Wallet Compressed:

1Q1pE5vPGEEMqRcVRMbtBK842Y6Pzo6nK9

HEX 2:
111111111111111111111111111111111111111111111111111111111111111101
public key:

034f355bdcb7cc0af728ef3cceb9615d90684bb5b2ca5f859ab0f0b704075871aa

Wallet Uncompressed:
                                 1Q1pE5vPGEEMqRcVRMbtBK842Y6Pzo6nK9

Private key wif:

5HwoXVkHoRM8sL2KmNRS217n1g8mPPBomrY7yehCuXC1115WWsh

public key comp:

b'\x03O5[\xdc\xb7\xcc\n\xf7(\xef<\xce\xb9a]\x90hK\xb5\xb2\xca_\x85\x9a\xb0\xf0\xb7\x04\x07Xq\xaa'

Wallet compressed:

1Q1pE5vPGEEMqRcVRMbtBK842Y6Pzo6nK9

HEX 3:
111111111111111111111111111111111111111111111111111111111111111100
Public key:

034f355bdcb7cc0af728ef3cceb9615d90684bb5b2ca5f859ab0f0b704075871aa

Wallet Uncompressed:

1Q1pE5vPGEEMqRcVRMbtBK842Y6Pzo6nK9

priv compressed:

5HwoXVkHoRM8sL2KmNRS217n1g8mPPBomrY7yehCuXC1115WWsh

public key compressed:

b'\x03O5[\xdc\xb7\xcc\n\xf7(\xef<\xce\xb9a]\x90hK\xb5\xb2\xca_\x85\x9a\xb0\xf0\xb7\x04\x07Xq\xaa'

Wallet compressed:

1Q1pE5vPGEEMqRcVRMbtBK842Y6Pzo6nK9

Pls i want to know how possible for the different hash to have same wallet.
NOTE: I am using bitcoin python library to generate the wallets
Only the first hash is valid on bitaddress.org when checked for details.

Private keys are 256-bit numbers. The first "HEX" you list has 64 characters, which corresponds to 256 bit, while the other two have 66 characters. Since all three share the same first 64 characters, I surmise that the library you're using simply drops the additional data beyond the first 256 bit.


DNS seeder 'options' I've seen various 'options' that the different DNS seeders support, for example x1, x5, x9, and xd:

vSeeds.emplace_back("seed.bitcoin.sipa.be", true); // Pieter Wuille, only supports x1, x5, x9, and xd
vSeeds.emplace_back("dnsseed.bluematt.me", true); // Matt Corallo, only supports x9
vSeeds.emplace_back("dnsseed.bitcoin.dashjr.org", false); // Luke Dashjr
vSeeds.emplace_back("seed.bitcoinstats.com", true); // Christian Decker, supports x1 - xf
vSeeds.emplace_back("seed.bitcoin.jonasschnelli.ch", true); // Jonas Schnelli, only supports x1, x5, x9, and xd
vSeeds.emplace_back("seed.btc.petertodd.org", true); // Peter Todd, only supports x1, x5, x9, and xd

(from chainparams.cpp)

But I can't find anything which actually explains what these options are. What do these options do and why do only some seeders offer some of the options?

This is 'service bit filtering.'

You can run nslookup seed.bitcoin.sipa.be, and get a list of bitcoin nodes.

You can also run nslookup x1.seed.bitcoin.sipa.be, and get a list of nodes with NODE_NETWORK set.

(source 1. source 2.)


bitcoin-qt "backup wallet" vs copying wallet.dat I am new to bitcoin, I wander what are the differences, and pros/cons (if any) between the file generated by bitcoin-qt when clicking on "backup wallet" vs copying the file "wallet.dat"? I see these files are indeed different with "cmp" so I am assuming that there are differences between these files. Can one of these files recover all of the information in the other?
EDIT: after a few backups I noticed that if I close the wallet, and then wait a few minutes. A backup at this moment equals the wallet.dat file.

Maybe its copying it safely in a way that you can re-use it without any issues.
Update and lock the wallet, preventing any file corruption caused by updates during the copy
Luke Dashjr mentioned one of the reasons here: https://github.com/bitcoin/bitcoin/pull/18219#issuecomment-595010266


Escrow multisig output tx Can someone please explain the third (Escrow) output transaction listed here:

https://blockchain.info/tx/09dd94f2c85262173da87a745a459007bb1eed6eeb6bfa238a0cd91a16cf7790?show_adv=true

What the exact intention and the expected result ?

Check the third output script:

OP_1 032487c2a32f7c8d57d2a93906a6457afd00697925b0e6e145d89af6d3bca33016
02308673d16987eaa010e540901cc6fe3695e758c19f46ce604e174dac315e685a OP_2 OP_CHECKMULTISIG

Essentially it's saying that in order for the transaction to be valid, the input script (scriptSig) must provide signatures for one (OP_1) of the public keys listed above.

So both the owners of the private key associated with either 032487c2a32f7c8d57d2a93906a6457afd00697925b0e6e145d89af6d3bca33016 or 02308673d16987eaa010e540901cc6fe3695e758c19f46ce604e174dac315e685a can validate that output.

This allows for scenarios where you need one of multiple entities (escrows) to validate a transaction before sending it off to someone.

Here's more info on OP_CHECKMULTISIG https://bitcointalk.org/index.php?topic=38903.0


Litecoin /Bitcoin addresses I have just bought some Litecoin and Bitcoin. There are many addresses that seem to be created as I press Send and Receive.
Do I need to allocate one of those generate addresses to my purchased Coin or can I just press Send and put the Recipient address. What happens when I put my email address ?

I'm so bad at this.
Thanks
Chris

If you're considering pasting your email as a public address to withdraw funds to, then I would recommend you search out some 'intro to bitcoin' or 'how to use bitcoin' videos on Youtube. I think watching a few of those will be quite helpful, at the very least they should provide you with enough knowledge to ask better questions. I'm not trying to be rude, but you're asking vague and wide questions about some very basic functions. Its OK to be 'bad at this', everyone starts there! With a bit of work, the system will seem less foreign to you very soon.

To take a stab at answering your Q more directly: Your wallet software can generate a million addresses, or more. Doing so doesn't really matter or accomplish anything, an address only 'becomes important' once you send bitcoin to it.

The coins you bought are probably sitting on an exchange service right now (I'm assuming you used something like Coinbase), so you probably want to withdraw them to a wallet you actually control. To do so, you'll install some wallet software, and it will generate some receiving addresses for you. Open up your exchange account, and paste one of the receiving addresses into the 'withdraw' field (it doesn't matter which address you paste in, just pick one from your wallet). Next you'll press submit/confirm, and after some time the exchange service should submit a transaction to the network to withdraw your coins.

Litecoin is a separate network, so you'll have to do the same thing again, but using litecoin software that will generate a litecoin receiving address for you.

If you try to withdraw to your email address (or anything else that isn't a valid bitcoin address), the wallet software will give you an error message, you will not be able to submit a transaction like that. The code is built to guard against errors.


Plot of distribution of all bitcoin transaction fees paid? Is there a way to find and plot every transaction fee ever paid on the blockchain/bitcoin?
Background
I have read about transaction fees:

Though the average Bitcoin transaction may be around $25, for example, the median is closer to what most users will likely need to pay.

At that rate, if you want to send a transaction right away, the fastest transaction fee is currently around 102 satoshis/byte, according to bitcoinfees.earn. For a median transaction size of 224 bytes, this results in a fee of 22,848 satoshis, or $11. If you don’t mind waiting roughly a half hour, the price would be 83 satoshis/byte, or about $9. The price continues to slide down from there if you’re willing to wait even longer.

So this gives very useful info, but if I want to see the distribution of all historical transaction fees on the blockchain, how could I do that?
Also, because the value of bitcoin has changed a great deal over the past several years, it would be sensible to measure the transaction fees in USD equivalent (like the article does).
Is this easy to do (or even possible at all)?

So this gives very useful info, but if I want to see the distribution of all historical transaction fees on the blockchain, how could I do that?

The information doesn't look useful. Distribution of fee rates used by unconfirmed transactions can be checked on many websites like https://mempool.space/ https://mempool.observer/ https://btc.bitaps.com/

Fees per transaction (BTC) in last few years:

https://bitcoinvisuals.com/chain-fees-tx-btc
There is one open PR to add mempool stats chart in Bitcoin Core GUI as well:
https://github.com/bitcoin-core/gui/pull/108
If you want to get fee rate and fee used in all the bitcoin transactions until now, API for any block explorer can be used. There are also few open source explorers like Esplora, NBXplorer, mempool etc.

Also, because the value of bitcoin has changed a great deal over the past several years, it would be sensible to measure the transaction fees in USD equivalent (like the article does)

Depends on the usecase. Bitcoin protocol is not aware of exchange rate for BTC. I would prefer to use sat/vByte for fee rate and BTC for fees.


Is it possible to use the same payout address on multiple miners at the same time? I just started out mining, and I'm using Nicehash to mine BTC, so my question is if I ran the Nicehash client on two different computers in my house, both using the same wallet address, does it add the profit to the wallet? What are the problems with it if i do use this?

You could use the same address with both miners and there would be no problem. Addresses can be reused, even though this is not recommended due to privacy concerns.

However, you will never manage to mine any bitcoins with home computers. They're too slow and don't contribute enough proof of work to get paid.


What is the status of hierarchical deterministic wallets (BIP32) BIP32 specifies hierarchical deterministic wallets, where a master seed fully determines a whole tree of keypairs that can be arbitrarily branched. It also introduces the notions of internal and external keypair chains that can be used independently to generate public or private keys.

Now I know that for example Armory uses deterministic wallets, but I cannot seem to find any implementation of the branching feature as described in BIP32. In particular, I want to generate a chain of linked addresses which are spendable using only one of the keys from my wallet as seed of a new branch (roughly the use case described in Recurrent business-to-business transactions).

Are there any other implementations of BIP 32 I am not aware of? Are there any plans to (fully) implement BIP 32 in Armory or any other client?

I started implementing BIP32 for the reference client myself, but as there were more urgent matters to deal with, I have temporarily stopped working on it. I certainly plan to complete this, but I can't give any target date or version right now.

As far as I know from Alan Reiner (Armory's developer), he plans to switch to BIP32 as soon as the reference client implements them as well.


How do different blockchains communicate? I've learned that the different cryptocurrencies have their own P2P blockchain networks.

How do exchanges convert coins from one network into a coin on another network?

Cryptocurrency exchanges are generally taking custody of your funds while you are using their service. You send a deposit of fiat to their bank account or cryptocurrency to an address under their control and after this payment has been confirmed, they credit you a balance on their platform. When you trade one currency for another, they only update their liabilities to you in their database. Only when you withdraw, they send you the corresponding cryptocurrency to your address or wire you fiat.

As you see, the exchanges simply accounts for what they owe you and there is no need for various blockchains to communicate beyond the exchange sending and receiving payments in various currencies.


If well-built wallet software can avoid transaction malleability, why does the lightning network need an additional malleability fix? My understanding is that wallets can avoid creating malleable transactions. If so, why does a lightning network need SegWit or some other tx malleability fix?

My understanding is that wallets can avoid creating malleable transactions.

It depends. For typical transactions, standardness rules on the network make malleated transactions unlikely to be relayed and confirmed. But this is just based on goodwill of the network and miners. As was shown recently, it's trivial for miners to stop enforcing this. As there are no consensus rules that prevent malleated transactions from confirming, generally every transaction is at risk.

Perhaps what you are referring to is that good wallet software can cope with malleability. They detect when a modified version of their transactions gets confirmed, and treat it as a replacement for the original. For simple payments, this is usually sufficient.

  If so, why does a lightning network need SegWit or some other tx malleability fix?

Because Lightning does something that regular transactions don't do: rely on having pre-signed transactions depending on unbroadcasted potential future transactions, and expecting them to not be invalidated. Malleability breaks this assumption.