How to check status of an order on BTC-e API?

It appears you are looking at "active orders" if you are seeing this status. As per BTC-e API documentation (found at: https://btc-e.com/api/documentation), you should be looking at trade history, which will show completed orders. Partial orders would show as individual trades on as the result e.g. if you place a sell/ask order 1 BTC @ $1000 and I were to place a buy/bid order of 0.1 BTC @ $1000 then you would see a trade of 0.1 BTC @ $1000 in your trade history, if I were to place the same order again against your 0.9 BTC remaining you would see two trades for 0.1 BTC @ $1000. This data is shown here for partial trades even if the order is still active.

Since the standard output is limited to the 1000 most recent transactions, I would recommend making use of the 'from' parameter when scraping trade data. You can increase the number of results but BTC-e will likely place a limit on how much data can be returned at some point in the future. You can also stagger API calls to get 1000 transactions at a time, however I would recommend putting this data in a table for better access.


Disclaimer: I proposed a partial solution myself to this problem (BIP 143, see below).

  Did the miner collude with the creator of the transaction?

Yes, because they are the same person.

It's a transaction that consumes a ton of dust outputs, and converts them to fees, which the miner claimed.

I doubt that the intention was to cause problems; it may just have been an attempt to clean up a lot of dust at once.

However, it did make it more obvious that the theoretical problem of quadratic hashing time for verification of blocks was real. The cause is that every signature requires computing a different hash, and that that hash is computed using the entirety of the transaction as input. Thus, if the number of signature checks in a transaction grows, both the number of hashes to compute as the amount of data each of them needs to hash increases.

Several solutions have been proposed:

Limiting the maximum size of transactions.
Limiting the total amount of data hashed by a transaction.
Changing the way hashes are computed.

1 (and to a lesser extent 2) would harm potentially useful large transactions in the future, depending on what the limits are. In particular, scaling solutions that rely on collapsing multiple payments into a single transaction may get hurt.

Deploying 3 for existing transaction outputs would require a hard fork, and a change to every piece of wallet software. Additionally, it would invalidate any pre-signed but unbroadcast transaction.

However, 3 can be deployed for a new type of transaction output. BIP 143 describes a new signature hashing mechanism that is at worst linear in the size of blocks, but only applies to transaction inputs that spend segregated witness outputs (see BIP 141).


Can you be 100% certain that a payment was sent from a specific address?

From the Bitcoin Wiki:

  An input is a reference to an output in a different transaction.

A transaction can have multiple outputs, e.g., a normal one and the change, which specify the recipient address in their scriptPubKey. So usually to each output belongs one address, and the input specifies which output it redeems.

If an output specifies multiple destination addresses (which is rarely the case), only one of those can redeem the transaction. You can find out which one by looking at the scriptSig of the input.


How to import a private key in bitcoin-qt?


dont worry

your 0.30811325 btc sent by this transaction are waiting for you

you have to synchronize your client to see and use your funds


Bought a bitcoin, sender said it was sent, not showing in blockchain or wallet. Where is it?

LocalBitcoins uses escrow. If you've released payment and not received the Bitcoin all you need to raise a dispute. If you've already finalised the purchase and the Bitcoin isn't in your LocalBitcoins wallet then there's very little that can be done.

To clarify: did the Bitcoin ever get credited to your LocalBitcoins wallet? If not, raise a dispute ASAP.

I've never had issues with LocalBitcoins but I've never ventured outside of escrow or used gift cards.


Why not use address in raw transaction instead of public key bytes

In raw transaction, bitcoin using bytes of the public key, like:
042daa93315eebbe2cb9b5c3505df4c6fb6caca8b756786098567550d4820c09db988fe9997d049d687292f815ccd6e7fb5c1b1a91137999818d17c73d0f80aef9

Technically the raw transaction contains the Script, which usually is written with Bitcoin script that is a stack-based language. It can contain the PubKey in the old scripts, like P2PK but the community is making a big effort to move the bitcoin users to use the script that contains the hash of the public key. The script like Pay-to-Public-Key-Hash (P2PKH) or pay-to-witness-public-key-hash (P2WPKH).
from the script, it is possible to calculate the address but not vice versa.
In conclusion, all the addresses have a conversion like:

P2PK, P2PKH: Start with 1.
P2SH: start with 3.
P2WSH, P2WPKH: Start with bc or with 3.

At this point, the answer should contain a resume of all the types of script and how the script is built, and also an introduction to the not standard script that is used extensively from the lightning network protocol.
But I think a very good summary is inside these two chapters of the Bitcoin book 'Transactions' and 'Advanced Transactions and Scripting', I can't do better
Update
I'm not a fan of theory, maybe you can use also this code example to understand how the script is converted on a Bitcoin address.
Decompiler Bitcoin Script.
it is only an example of the conversion that could be done.
The usage of the example code is described inside the bash script run-decompiler.sh
An example with the following block is the following ./Decompiler 76a914536ffa992491508dca0354e52f32a3a7a679a53a88ac
With the following result
----------------------------------------| Results |-----------------------------------
                               ###  Script PAY TO PUBLIC KEY HASH  ###
  Raw Script PubKey: 76a914536ffa992491508dca0354e52f32a3a7a679a53a88ac

OP_DUP OP_HASH160 536ffa992491508dca0354e52f32a3a7a679a53a OP_EQUALVERIFY OP_CHECKSIG

 The address: 18cBEMRxXHqzWWCxZNtU91F5sbUNKhL5PX
 The Hash160 pubkey: 536ffa992491508dca0354e52f32a3a7a679a53a
 The P2PSH address: 39JC9tvQ5CANbfuPgUZ4Zdc227m5uQnMRB

 https://blockstream.info/address/18cBEMRxXHqzWWCxZNtU91F5sbUNKhL5PX
______________________________________________________________________________________

See the result here https://blockstream.info/address/18cBEMRxXHqzWWCxZNtU91F5sbUNKhL5PX
Please consider this example as an example of code, I developed this to understand how de script works. Can contains error. I will work to integrate this in my project and I will maintain this post update.
To answer at your comment that is

Thanks. I use you the code linked, the the result address codepad.org/nRJhvMC3 does not match the expected address blockchain.com/btc/block/1 So what's the usage of this Decompiler?

The decompiler takes the hex of the script and try to calculate the corresponding address if it is a standard script.


btcchina how to deposit with mastercard?

you need to make a wire transfer to a china bank or fund your account with bitcoins


Bitcoin controls the supply of coins by halving the miner subsidy (reward) every 210,000 blocks or roughly every 4 years. The miner subsidy started at 50BTC. See Mining Reward.

This is a simple chart that illustrates the Bitcoin distribution schedule:


What happens when tx is broadcasted whose input is not yet received by mempool or are unknown?

Such a transaction is called an orphan transaction.

When you announce a transaction to a peer who misses one or more of its inputs, the transaction will be placed in the orphan pool - where they are temporarily held in the hope that their dependencies arrive. A request will go out to fetch those dependencies from whoever sent us the transaction.

The transaction won't be relayed until it can be validated. Once all dependencies arrive, they will all be subject to normal validation and relay policies, and if acceptable, relayed in dependency order.


OK. I've found a workaround by adding label on importing :

bitcoin-cli importaddress <address> my_imported_address_list

Checking my label on listing :

bitcoin-cli getaddressesbyaccount "my_imported_address_list"

This solves my problem for now. But still searching for better answer where i dont need to label my own imported addresses.


Bitcoin Core v0.21 RPC credentials going bad

Ok, I managed to find the culprit. It's actually an application I have running in the background that I simply completely forgot about it and it is trying to access to the RPC interface and as I have never paid too much attention to it, I think I never setup anything related to RPC in it. So, most probably that's the problem.
I used netstat -p -at and ps -ef to figure out what exactly was interacting with bitcoin core daemon.
Thanks every one. I think this one is solved.
Psy


My client stopped synchronizing, how can I access my wallet?

I can help!

Your money is "yours", it just isn't being listed in your wallet because as you say, your wallet is having trouble updating... That's OK! You can access it in other ways, such as an online e-wallet:

First, we need to get your "private key":

Close bitcoin completely, then
Open control panel, select "large icons" in the top right corner
Click "folder options", or if you are opening it from the start menu, just click "folder options"
Click the "view" tab
under "hidden files and folders", click "show hidden files and folders and drives"
Deselect "hide extensions of known file types", this will allow you to see the bitcoin working folder
press OK
right click the start button and click "open windows explorer"
doubleclick "local disk (c:)" under "my computer"
doubleclick "users"
doubleclick "yourusername" eg "john"
doubleclick "appdata"
doubleclick "roaming"
doubleclick the "bitcoin" folder

(this is for Windows 7, for XP the directory is C:\Documents and Settings\YourUserName\Application data\Bitcoin (XP))

right click an empty area in the folder and select "new">"text document"
doubleclick the new text document
type the following 2 lines into the empty text document:
rpcuser=someusername
rpcpassword=somepassword
replace someusername and somepassword with anything (you don't have to remember it later) so button mashing udhf9w8dg98rgu will work (no spaces)
"file">"save as" type "bitcoin.conf"
press save
Right click the start button and click "open windows explorer"
doubleclick "local disk (c:)" under "my computer"
doubleclick "program files(x86)"
doubleclick "bitcoin"
hold shift and right click on "daemon"
click "open command window here"
type "bitcoind"
leave that window open,
Wait 2 minutes for the daemon to load
Don't close the window
Go back to the explorer window, and again,
Hold shift and right click on "daemon"
Click "open command window here"

If your wallet is encrypted, go to A then proceed to B if not go straight to B

A: type "bitcoind walletpassphrase 600" where walletpassphrase is your wallet password and press enter
B: type "bitcoind dumpprivkey 1YourBitcoinAddress1234567890"

replace 1YourBitcoinAddress1234567890 with the address where you withdrew the money to. You will get a long string of numbers. Leave this window open...

Upload the private key to a managed service

Goto blockchain.info
click "wallet" at the top
click "start a new wallet"
sign up for a new wallet
once your new wallet is created, log in to it.
go to the tab that says "import/export"
press "continue" at the warning
where it says "import private key", type the long string of numbers EXACTLY from the black window
press "add private key"

Your wallet is now managed online.


How do cryptocurrency exchanges work with so many currencies at the same time?

One way is to write software for each cryptocurrency as you suggest.
A lot of it would be reusable code as you can just interface via RPC with your wallets.
Another way is to use a wallet that supports multi currencies and then interface with that wallet.

But lets examine what really is required
depostis

those are essentially free as all you need is an address that you control. You can either create a list of addresses in advance and then use those whenever a user requests, or you can write code that creates these addresses. Now a lot of cryptos use the same elliptic curve therefore private keys can be reused across cryptocurrencies and you just create the appropriate addresses. Now of course you dont want your private keys online, so again pre-creating lists of deposit addresses makes sense

withdrawals

here all you have to do is be able to compose a valid transaction, sign it and put it on the appropriate network. This work will be the same for a lot of cryptos.

In the end i believe that exchanges do run wallets for each crypto they deal with, it helps with staying up to date with the chain, to spot re-orgs, and of course to interface with that particular cryptocurrency

This is just conjecture of course, i have never built a crypto exchange myself :)


I think Opt-in Replace By Fee is what you are looking for. The wallets implementing RBF lets you mark your transactions as unfinished and that let's you replace it with more fees than the previous one. But merchants are advised to wait for at least one confirmation before accepting optin rbf transactions (to avoid a double spending risk).

The only wallet I know that have implemented RBF is Electrum.

Below you have some useful links:

https://bitcoincore.org/en/faq/optin_rbf/

https://petertodd.org/2016/are-wallets-ready-for-rbf

https://electrum.org/#home


Your transaction's fee was pretty low compared to the transactions that are currently happening on the network.

Your transaction was big with 2580 bytes, and that makes your fee work out to be only 22.3 satoshi per byte. Currently, transactions are confirming in the next block that are paying about 60 satoshi per byte.

There are about 35k transactions ahead of yours in line. (But new ones join the line, so it's going to be a while.) You might want to resend the transaction with a higher fee, if you know how to do that.

Otherwise check out Why is my transaction not getting confirmed and what can I do about it?


How do you know your public key from a private key?

If the public key can really be derived from the private key, isn’t the opposite true?

Nope, thats the wonder of asymmetric key cryptography! You can easily derive the public key from the private key, but going the opposite direction is equivalent to brute-force guessing you way through an impossibly large set of numbers (ie, impossible). So the public key and private key are mathematically related, but this relationship is "one-way", so to speak. This is why you can share your public key with other people, but you should never, ever share the private key!
Once someone has a private key, they can use it to derive the public key and bitcoin address easily. But having a public key gives them no knowledge of the private key, since the math doesn't work the same both ways.
In bitcoin, the public key is derived using the Elliptic Curve Digital Signature Algorithm (ECDSA).

Then you give one key the name public key, and give the other key the name private key
...
I mean, we can choose whichever is the private key when we generate them.

I think this is where your misunderstanding comes from, the distinction of 'public' or 'private' is not arbitrarily chosen. One is derived from the other, their relationship is mathematically defined.


when I send money from my wallet, which address shows up as "sender"?

Bitcoin doesn't really have sender addresses.

Every transaction consumes some of your coins, and creates one or more new coins, potentially assigned to a different address. What the receiver can see is the transaction, and he can trace which coins it spent, and which addresses those coins were previously assigned to. Some programs/sites use the first such address as sender, but this is not recommended. It doesn't say who sent the money - only who previously controlled it (which may for example be a shared webwallet).

The reference client always considers its entire pool of (confirmed) coins as source for creating transactions. The recently (0.7.0) introduced raw transaction API allows fine-grained control over which coins are used as input, but does not have a GUI (yet).


bitcoind JSON-RPC interface timeouts under unit tests

I used BitcoinLib to perform 15,000 consecutive listtransactions calls and the result was:

0 timeouts
Fastest response: 0.1133479 sec
Slowest response: 0.6475277 sec

bitcoind was started with the default parameters and was receiving blocks during the test.


Does calculating how many bitcoins I have take longer as time goes on?

With a naive implementation, yes, but in practice, no, it is not a problem.

This is because any developer that knows what they are doing is smart enough to create a database which, at the very least, records each transaction (or its position on disk) and its verification status. So when you receive a new transaction, instead of having to walk back through history, you just need to look back to the referenced previous transaction. As part of validating a transaction, you check if the previous transaction was valid. So if a transaction is marked as valid in your database, then you can be sure that the transactions that preceded it  are also valid. Thus there is no need to actually look through history and re-validate those transactions.

Since it ultimately just comes down to a simple database lookup, it does not become harder to validate new transactions.


I had this issue also the fix for me was  adding--scrypt -o to the beginning so it look like this :

--scrypt -o stratum+tcp://stratum.scryptguild.com:3333  -u iwantcoins_nick -p nopw --load-balance


What does this mean? RPC_CLIENT_NOT_CONNECTED = -9, // Bitcoin is not connected

What does this mean? I'm running the command on the same machine where the daemon is running, so no remote connection needed.

It's not talking about the connection between your command line and the Bitcoin daemon, it's talking about the connection between your Bitcoin daemon and other Bitcoin daemons.

  How can this happen? Why does a stable running bitcoind daemon suddenly gets disconnected?

You might be running a very old version of Bitcoin that is incompatible with other clients. Your ISP might be filtering Bitcoin traffic. Your OS might be out of file descriptors. There are a huge number of possible reasons.

To narrow it down, have you tried looking at the debug.log of your Bitcoin client? You could also try looking at TCP traffic on port 8333 using Wireshark.


If I restore my electrum wallet from seed will I lose my pending transaction

Your transaction is out in the network. It doesn't need to be rebroadcasted by your wallet (which probably doesn't do this anyways all by itself) in order to survive. It just needs to be in someone's mempool. Deleting your wallet will not stop the transaction. When you delete your wallet and restore it with your seed, you will have access to the same money you have access to now, but the notes you may or may not have stored in your Electrum wallet will be gone.


HELP BITCOIN SENT CONFIRMED BUT I NEVER RECIEVED BEEN 2 DAYS

BITCOIN SENT CONFIRMED BUT I NEVER RECIEVED BEEN 2 DAYS

In reality Bitcoins are not actually sent or received. Those are not two separate events. They both really refer to the same event. If the Blockchain shows unspent bitcoins (unspent transaction outputs) associated with an address you control, you have "received" them - regardless of what your wallet says. This is easily checked using a blockchain explorer

  heres the id 7581e42bf71df4b81fdb233542f3e0baeddeb60bd5e11361b1f8cb7ccb3553a5

That transaction currently has 450 confirmations. It also has 12 inputs and 52 outputs. Presumably Pax have batched up their customer transactions and one of those 52 outputs is an address you gave to "Pax" (Paxful.com?).

If that address was generated by a desktop or mobile wallet, it's failure to show the amount expected could be due to a number of reasons - for example maybe it isn't fully synchronised for some reason?

  is anyone able to help me recover this?

Only the person or organisation who has the private keys from which the relevant output "address" was generated. Normally that would be you alone.

It may be that this isn't a question of "recovery" in the sense of recovering money transmitted somewhere. Perhaps you just need help finding out why your wallet doesn't show the expected amount associated with the relevant receiving address you gave "Pax". That would be a different question and depends on what wallet you use.

  is it gone for good?

The transaction is final. If you know who "received" the output in question, you can ask them for help. You could start with "Pax"


Difference between wallet and mining software?

The main difference is that the wallet software does not mine or add onto the blockchain as the mining software does. Mining software attempts to find a valid Proof-of-Work, i.e., find an input to the hash function such that the hash is below the target, and has the ability to output a new block if the correct answer is found.  Wallet clients download the entire blockchain, but do not mine for blocks as the mining software does.

In the past when the difficulty was low, the mining software and wallet were in the same program, but they have since split and now many versions of both wallets and mining software exist.


spending some of the coins nullifies address' balance. where does the remainder goes?

As you may know, transactions have inputs and outputs. The outputs give the addresses to which coins are being sent, and the inputs link back to outputs of the prior transactions that gave the coins to this transaction's sender, thus forming a chain. Anyone on the network can step along this chain to verify that all the coins in circulation legitimately got to their present owners.

To make it easier to verify the chain, the Bitcoin protocol has a rule that each input must spend all the coins that were in the output that it links to. (I am presuming that Litecoin is the same.) So if the smallest (or only) transaction to your address had
an output of 150 LTC, then you have to spend 150 LTC. But since you only really want to spend 45 LTC, your wallet gives the transaction a second output that sends the remaining 105 LTC back to you, as "change".

Rather than sending the change back to the same address that is spending the coins, some wallets choose to generate a new address and send the change there. I am not exactly sure why; perhaps it's to help obscure what addresses belong to whom, for privacy. But in any case, you should find that your wallet holds the private key to this new address. The 105  coins are still yours, they're just at a different address.


How do we check the time when a transaction hits x confirmations?

The first confirmation was in block 298902, so the third confirmation was with block 298904, which is timestamped as 2014-05-03 09:42:49 (66 minutes after it was first received).

However, this timestamp is later than the one in the block after it, suggesting that a timestamp was pretty far off. As Matthieu's answer shows, blockcypher.com's API includes the time that they first saw the transaction. This suggests that the actual time three confirmations was reached was around 2014-05-03T09:31:55.867Z, approximately 59 minutes after the transaction was created (since it was relayed by Blockchain.info, I'm assuming the transaction timestamp there is accurate).


Javascript Bitcoin miner is it even worth it?

It is true that mining Bitcoins like this is impossible. (I can't speak for altcoins though.)
Let us run through a back-of-envelope calculation based on some facts and assumptions.

Network hash rate is 800 000 terahashes per second as of 2016-01-18 [source].
Remember that currently 25 BTC are rewarded every 10 minutes.
A modern consumer-grade CPU has 4 cores, and can calculate about 400 MB/s of SHA-256 per core in C. (More generous than JavaScript, but ignoring the upcoming Intel SHA Extensions instructions.)
One Bitcoin hash trial uses 2 blocks of the SHA-256 compression function (each block is 64 bytes), so this translates to 8 million hashes per second per core, and 30 million hashes per second per CPU.
One visitor donating 5 minutes of full-CPU time gives 9 gigahashes.
Multiplied by 2 million visitors per day gives 18 petahashes per day.
Meanwhile the rest of the Bitcoin network has produced 70 000 000 petahashes in a day and mined 3600 BTC.
The current price is 1 BTC = $400 USD. Your 18 PH out of 70 000 000 PH is 0.000026%, so this yields 0.0009 BTC reward, equaling $0.37 USD per day in total. But divided among everyone, this equals $0.0000002 per visitor.

With 2 million visitors a day though, why not optimize the ad revenue, user retention, conversion funnels, and other traditional online business techniques?


Bitcoin Core on a Linux partition on MacBook... Lost bitcoin due to insufficient disk space to update blocks

You can set Bitcoin Core to run in "pruning mode" which will then keep only the last few blocks instead of the whole blockchain.

To enable pruning, you add the line

prune=<n>

to your configuration file whereby you replace <n> with the number of megabytes of blockchain data you want to keep. The minimum is 550.

The configuration file can be found in the Bitcoin data directory by default it's found at ~/.bitcoin on Linux. The configuration file is called bitcoin.conf. If the file doesn't exist yet, you can just create a text file by that name.

Also see:

How can I run bitcoind in pruning mode?
Where is the data folder for Bitcoin-Qt?
Jameson Lopp's Bitcoin Core Config File Generator


Wouldn't a full node use nearly the same space for large or small block sizes?

I think the logical issue with that argument is the assumption that larger block sizes = less # of blocks. More likely, the number of blocks would stay the same (a block is "mined" into the blockchain about once every 10 minutes). Thus, the capacity of the blockchain would increase.

Only if you assume that the number of transactions currently being "saved" into the blockchain is the upper level of the demand for such transactions would the storage size not be affected by larger block sizes.


Bitcoin cli asks to use estimatesmartfee with new syntax that is not described in docs

estimatesmartfee requires that bitcoind have been running long enough to gather data about the current fee rates on the network. This can take some time. Try running it again after a few hours, or a day or so, once it has collected data.


Is there any altcoin with improvements in blockchain download time?

Your premise is wrong. The work required to download and validate the blockchain has nothing at all to do with the work required to mine it.

As far as the block hash goes, validating it requires just one hash while mining the block requires quintillions of hash calculations.

Validating the block also requires computing the hashes of the Merkle tree but the main work is validating ECDSA signatures. Your method is not going to help with that.

(On a meta note, it's rude to offer "improvements" when you don't understand well enough what currently exists.)


As a result I've got 2 arrays: block hashes (array A) and parent references (array B). Then if I subtract B from A, I would get a list of orphaned blocks.

No, doing that will get you a list of stale blocks (which are commonly referred to as orphaned blocks). What you are doing is getting all blocks which are not parents of anything, not blocks which do not have parents.

000000000000000003D57B69D1AC77F64287C893C16ADBC1816C6D7386CCC3C0 – orphaned

The term "orphaned" here means that the block does not have any children. This is the second meaning of the term "orphaned block". This result is expected since you are removing from your list of block hashes the list of parent blocks, and this block is not a parent.

0000000000000000011523D7477DD274B7E0DCC2C616B2E2F584FFDEC20237D3 - main chain

This block is in the main chain. It is probably in your list because that is what your node was synced up to and this was its most recent block.


Would it be feasible to attack the bitcoin network by buying and deleting large amounts of bitcoin?

The bitcoins are still there, but without the private keys they would be unspendable and it would be highly unlikely that anybody would ever rediscover the private keys.

However, such an attack would not hurt the bitcoin network: The previous owners would already have been compensated through the sale, and as the total value of the network remains approximately the same, the network's value would then redistribute to fewer units of bitcoin, increasing the value of each remaining unit. The attack would only make the bitcoin users wealthier.

Even if all but a single bitcoin were lost, the network could carry on: It has been discussed many times (see money-supply, divisibility), that it would be simple to adapt the bitcoin protocol to divide into smaller subunits. Currently Satoshi are the smallest subunit and there are 10^8 Satoshi per Bitcoin, but if the protocol were adopted to allow bitcoin to be divided to 10^16 units, there would again be sufficient money supply to serve a global market to make payments in any amounts.


Do bitcoind and bitcoin-qt resume blockchain downloading from the same place?

bitcoin-qt and bitcoind are built from the same source code. They largely use the same settings, data directory, and configuration file.

However, bitcoin-qt has a set of options that are specific to it. These settings are stored in a separate Qt defined location (on Windows, it's stored in the registry). bitcoind cannot read these settings. If you set your data directory by choosing the location in the dialog box that appears the first time you started, the data directory location is stored in the Qt specific settings so bitcoind cannot read it.

You can set the data directory for bitcoind by creating a bitcoin.conf file in the default data directory location (on Windows, that's %APPDATA%/Bitcoin) and adding the line

datadir=<path>

where <path> is the path to where you want the data directory to be.

Or by adding -datadir=<path> to the command you are using to start bitcoind.

  I use bitcoind -datadir=D:\bitcoin to do that, is it right?

Yes, that is correct.

  In my home directory (C:\Users\MyName) or just in the same data directory (D:\bitcoin)?

You should put the config file in the data directory that the software will open initially. If you are setting -datadir in your startup command or the datadir is specified in your Qt settings, then you should put the config file in the data directory.

If not, you should put it in the default data directory location which is C:\Users\<username>\AppData\Roaming\Bitcoin.

  Does bitcoind and bitcoin-qt use the same configure file?

Yes.


What wallets can be used to double spend (low tx fee workaround)?

As I understand if I send a new transaction, with a higher fee, I can reuse the (confirmed) inputs and that transaction will be accepted, then the transaction with the unconfirmed input will be abandoned.

No. It seems to me you are trying to do Replace-by-Fee, which you need same input that is unconfirmed transaction.

I assume that there are two transactions that you want to get confirmations. Can you post these transaction id so that I might be able to help you.


What good is to store all the transactions in the history

The bitcoin blockchain is a record of all transactions. This allows the user to independently validate transactions, and thus verify the authenticity of coins. However, you don't need to store all of the transactions for all time, by running a 'pruned node' you can keep disk-space usage low, while still verifying all transactions.

Background: bitcoins exist as 'Unspent Transaction Outputs' (UTXOs). Each individual transaction will consume some number of UTXOs as inputs*, and create new UTXO(s) as output(s).

Under this model, you can trace a UTXO back in time in order to validate it as being an authentic bitcoin transaction. For example, consider some bitcoin you receive today, lets call it 'UTXO-3'. In a simplified manner, you could trace the history of this UTXO-3 (to it's input 'UTXO-2', and so forth), until you find the coinbase transaction that mined the coins.

So ,going back in time, from your UTXO-3:

UTXO-3 <- UTXO-2 <- UTXO-1 <- Newly mined coins

This allows a bitcoin (UTXO) to be traced back to it's origin on the blockchain, which means you can validate it as an authentic bitcoin. Without this feature, you would be unable to verify for yourself that the bitcoin in question was created in a way which follows the network's rules. As mentioned above, bitcoin's design allows you to perform this verification without explicitly storing all transactions for all time (by running a pruned node).

Additionally, as Pieter mentioned in a comment, a user has the option to use a light-client, which does not require the user to store a copy of the blockchain locally (although this employs a slightly different trust model than running a full-node yourself).

.* (the exception to this rule is a coinbase transaction, which follows special rules to generate coins, without having any inputs)


Why are other sell limit orders being filled before mine on exchanges like gdax?

Look at the trade history on the right. Do you see any price other that the current ask and bid ? This means that orders with values other than 9000 and 8999.99 (to take the example below) are not filled, so those orders are getting canceled.

Keep in mind that this domain is heavily automated and most of the activity you see here is bots fighting each other. So this level of frequent adding/cancelling orders on the order book is quite normal.


The most obvious problem, it appears to me, is that they cost $1200. If you make $4 per day (assuming that's net profit after paying for electricity), it'll take about a year to pay for itself. That's assuming the mining difficulty stays the same for a year, which it almost certainly will not; in the last 12 months (March 2015 to March 2016), difficulty has more than tripled.

Unless the value of Bitcoin rises substantially (faster than difficulty), I'd be skeptical of coming out ahead.


How does CDataStream data find its way into a socket?

CNode has a method SocketSendData() which pushes all the serialized data into the socket.

https://github.com/bitcoin/bitcoin/search?utf8=%E2%9C%93&q=SocketSendData&type=Code


What is the difference between reliance on miners on Drivechains and Lightning?

I would consider these two crucial differences, so I guess you answered your own question. I guess the more important distinctions, though, are about the systemic impact of both:

Firstly, Lightning can simply be done with bitcoin as it is (OK, we needed segwit, but we needed that anyway). So it would be hard to keep people from using Lightning.

Secondly, the risk of miners stealing bitcoins in LN channels is probably not a problem: LN deals with small amounts, miners would have to collude with one side of every channel they want to steal, and breaking Bitcoin's censorship resistance in order to steal some LN funds would be such a nuclear attack that it would probably tank price AND lead to a PoW change.

On the other hand, IIRC drivechains explicitly expect miner consortiums to steal funds in unpopular sidechains. Very different risk profiles IMHO.


You can use electrum and create a dedicated wallet for your shop's transactions using this command:

electrum -w shopwallet -f 0.0001 -G 100 create

This will create a new wallet with a gap limit of 100 i.e. it will track 100 addresses by default (more will be tracked as you start receiving payments).

Once you have the wallet setup you can get the master public key (MPK) via the wallets menu > master public key. You can install the MPK on your web server allowing you to generate receiving addresses for your customers without risking your coins.

Two example implementations of this approach are:

Bitcoin payments for Woocommerce: http://wordpress.org/plugins/bitcoin-payments-for-woocommerce/

Stick's address generation scripts: https://github.com/prusnak/addrgen


Can I defraud the merchant, or the merchant defraud me, on the bitcoin or lightning network?

The merchant attempts to defraud me: I pay X satoshi to buy a smartphone, but I never receive it, and I'm afraid the merchant will never deliver it to me.

This is certainly possible, and Bitcoin-related scams like this happen all the time. If you're afraid of this, you really want to pay with Bitcoin, and you want to have some form of buyer protection, you should use a trusted third-party escrow service that will hold control of your coins until you confirm receipt of your smartphone, and the escrow can mediate any potential disputes. Most people in this situation would use a multisig wallet to keep the escrow themselves honest, but I don't think this is possible over Lightning Network (you'd need an on-chain transaction).

I attempt to defraud the merchant: I pay X satoshi, and the merchant eventually delivers it to me; I then attempt to refund the X satoshi payment after physically receiving the smartphone. (This is assuming we're both using the Lightning Network).

This is not possible with a completed Bitcoin transaction, nor over Lightning Network. Bitcoin transactions, once completed, are final.


Is there a help file for the bitcoin client?

Bitcoin Config Arguments
Bitcoin CLI Commands


Firstly, you need to know both all the public keys, and at least the threshold (M for a M of N multisig) number of private keys.
You can then import the public keys, private keys, and script to bitcoind by using the importmulti RPC command and either providing an output descriptor or a a raw address / scriptPubkey (+ redeemScript / witnessScript if using a P2(W)SH).
To quote the help:
$ bitcoin-cli help importmulti
importmulti "requests" ( "options" )

Import addresses/scripts (with private or public keys, redeem script (P2SH)), optionally rescanning the blockchain from the earliest creation time of the imported scripts. Requires a new wallet backup.
If an address/script is imported without all of the private keys required to spend from that address, it will be watchonly. The 'watchonly' option must be set to true in this case or a warning will be returned.
Conversely, if all the private keys are provided and the address/script is spendable, the watchonly option must be set to false, or a warning will be returned.

Note: This call can take over an hour to complete if rescan is true, during that time, other rpc calls
may report that the imported keys, addresses or scripts exist but related transactions are still missing.
Note: Use "getwalletinfo" to query the scanning progress.


clustering addresses, what's the most effective way?

Are there any others that are particularly effective?

Yes, if you know what wallet was used and if its transactions have distinguishing features. For example, multisig wallets usually use p2sh change, but the recipient rarely uses p2sh, which allows to determine the correct change output with high probability.

Data-Driven De-Anonymization in Bitcoin introduces two new general heuristics:

CONSUMER HEURISTIC. Consumer wallets only create transactions with two outputs. Therefore, if an output is spent by a transaction with 3 outputs it is not change.

OPTIMAL CHANGE HEURISTIC. The assumption is that wallet software does not spend outputs unnecessarily. Therefore the change value is smaller than any of the spent outputs.
Because if the change was larger than one output then this output would be left out and the change would be reduced by the output’s value.

The thesis also evaluates the effectiveness of the heuristics using data captured from Android Bitcoin Wallet with the Bloom filter address leak in late 2014.
It turns out that Multi-Input heuristic is by far the most effective: if applied to one address, in total 68.59% used addresses of the wallet are revealed.

By the way, the Heuristic 2 you mention was first described by Androulaki et al. in Evaluating User Privacy In Bitcoin.

  Is it possible to bootstrap my clustering, for instance, maybe if some people have already associated a certain cluster with Kraken or Satoshi Dice, is this information available?

Blockchain.info has a database of tags (https://blockchain.info/tags).


How to send bitcoins without paying or with extreme low fees and without having to proove my identity?

By a paper wallet from someone in person and wipe it with CoPay app.


c-lightning doesn't store old versions of the commitment transaction, exactly in order to avoid accidentally cheating. If you compiled with DEVELOPER=1 you can however call lightning-cli dev-sign-last-tx {peer-id} and it'll spit out the fully signed commitment transaction (that's why dev-* commands are dangerous and should not be used if you don't know exactly what you're doing, which is the case here).
Once you have the signed commitment, just perform some other action that creates a new commitment (feerate adjustment, send or forward a payment) and then send the now invalidated commitment transaction you got from dev-sign-last-tx to the network using bitcoin-cli sendrawtransaction and confirm it by generating a block. Both nodes should see the unilateral close and identify it as a cheat transaction. The cheating node will give up, since there's nothing it can do, and the cheated node can punish the cheater by claiming all the funds.


Please walk me through a typical page on blockchain.info

Why are there two addresses on the right?

Bitcoin transactions often have two outputs: one is the intended recipient, the other is a change address. This is because outputs must be used in their entirety, so the remainder is sent to an address that the sender owns. In this case, the change address was the address that the money was sent from, but this is not always the case (it can marginally improve security and anonymity to use a new address each time, including for change).

  What is the longer hash called that is directly under "Transaction" (not the address)?

The transaction hash. It is used as a sort of identifier for the transaction, but beware using it for that before it's in the blockchain due to malleability.

  Why do so many transactions occur in the middle of the ocean?

That is the lat/long coordinates 0N 0E. It really just means that blockchain.info has no good data on where this came from, so it defaults there.

  Are there any other better websites to view the blockchain than blockchain.info?

Not in my opinion, as far as I'm aware.

  What makes a transaction "High Priority"?

If a transaction includes a standard transaction fee and isn't non-standard, it will quickly be transmitted to nearly every miner in the world, who will start working them quickly. Some transactions have no fees attached, e.g. see this one (estimated time is "Within 6 Blocks (Medium Priority)") or find another on the unconfirmed list. These may be transmitted across the network, based on a few rules including the age and size of the inputs. Miners and nodes might not be as quick about transmitting these or may limit it to a few free transactions per block, so the transaction might not get into the chain as quickly.


If you don't already agree with the above answers and understand why they are true, I recommend strongly rethinking the idea of mining. Before investing a single cent into mining, please invest in yourself, and your comprehension of btc first.

If you're mining simply for the enjoyment of learning about this fascinating technology than I recommend mining yourself, and taking it very slowly. By this I mean to acquire an insignificant amount of hashing power (such as an ASIC thumb drive or similar) to get your feet wet, one that will not burn your house down or set your finances on fire.

Bitcoin mining is a deeply complex field and for the uninitiated its a surefire way to burn up.


Is it possible to configure the bitcoin daemon to only broadcast unconfirmed transactions with ZeroMQ?

With the current Bitcoin Core Version (0.14.2 by the time of writing), this is not possible.
A quick hack in CZMQNotificationInterface::SyncTransaction(const CTransaction& tx, const CBlockIndex* pindex, int posInBlock) would be simple (just add an if (!pindex)).

If you don't want to change the sources, you could call gettransaction over RPC and get the confirmation count.


Is there an open source Bitcoin exchange?

Intersango is an open source exchange that is used at intersango.com, which is an exchange operated by The Bitcoin Consultancy. The open source project that can be found here is released under the GNU Affero General Public License.

For more info on how to set it up, see this post on the bitcointalk forums: Intersango HOWTO - Build your own Bitcoin Exchange Web Site!


Bitcoin has only 8 active connections

Correction: it has 8 outbound connections. By default, it can also accept up to 117 inbound connections

  which port

Port 8333, TCP

  how should I tell Bitcoin-qt to use the forwarded port?

Don't need to.


celldice.com has an API over secure http,
see this link for details

https://celldice.com/api.en.txt


The prefix for transactions was changed from b'c' to b'C'.

Is there any specific reason for changing the prefix?

The entry changed to a new data structure. However in order to be able to upgrade previous database versions to the new one, we need to be able to identify which entry corresponds to the old structure and which corresponds to the new structure. So a different prefix is used.

The nVersion field was dropped from the database.

On the other hand, and regarding the version field, it was always set to the same value for every entry (can't recall if 1 or 0), so dropping it seems the right thing to do but, why was it included in first place?

nVersion is the transaction version. It should have been either 1 or 2 as those are the only transaction versions used on the network with version 1 being the most common.


Can this double-spend attack happen in Bitcoin?

Yes, double spend attempts can happen. They're the reason we need a blockchain in the first place. To be able to know which transaction was "first" and which one was the double spend we need an agreed-upon record of history: the blockchain.

Until a transaction is in the blockchain, there is no way to know whether it was the first or a double spend, so it's actually pretty irrelevant which is which. Once a transaction is in the blockchain it by definition becomes the "first", and all further attempts are "double spends" (and invalid, so they'll never go into that blockchain).

Proof of Work mining provides a slow ticking (and very hard to fake) clock that defines the order of transactions.

The only thing that can still screw you over is a re-org: another branch of the blockchain with possibly different transactions overtaking the branch that you were looking at before and becoming the de facto accepted branch. That's actually not uncommon to happen if you only have one or two confirmations but becomes exponentially less likely with each additional confirmation. That's why the white paper suggests waiting for six.


How to accept bitcoin and giving each user a unique address amd automatic withdrawal

You could use online providers such as:

https://www.blockchain.com/api
https://www.blockcypher.com/dev/

Or install Bitcoin Core to run a full node and use RPC APIs


How many channels can I create from a Lightning Node?

Question 1: is there only one wallet inside of this node? If so, is there a way to have additional wallets inside of the same node? Does one use the wallet address when one receives/sends funds (kind of like the way the Bitcoin address to receive/send funds)?

A wallet is not the same thing as an address. A wallet is a collection of addresses and their private keys or scripts. A Lightning Node is also a wallet; there is only one wallet, but there are still multiple addresses and private keys.

  Question 2: Is there a limit to the number of Channels I can create from "My Node"?

In theory, no. In practice, your computer could run out of resources to maintain open connections. Regardless, you can have multiple channels open and it should not be a problem unless you are trying to have hundreds or thousands of channels.

  Question 3: In this case, would I need 6 extra Lightning Network daemons ("lightningd") on my computer?  If so, then would each daemon have to assign a different port address? Is there be a better way to do this?

No, one daemon can have multiple channels.


Send a transaction using bitcoinjs-lib to testnet in a box

The propagate function isn't designed for testnet-in-a-box because there is no routing for requests in the bitoind program that testnet-in-a-box activates.
Rather testnet-in-a-box is designed for JSON-RPC, so you can use sendrawtransaction, which described in https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list.

This is the propagate function:

blockchain.transactions.propagate = function broadcast (txHex, callback) {
  dhttp({
    method: 'POST',
    url: 'https://api.ei8ht.com.au:9443/3/pushtx',
    body: txHex
  }, callback)
}


Different hash while creating genesis block

Maybe this is useful for someone: I didn't find why the hash was different, it's possible that the code I used for generating the genesis block is outdated.

Finally I used https://github.com/lhartikk/GenesisH0 and it worked, the only caveat was that I only was able to change the timestamp, when I tried to change other stuff (e.g. nBits) it failed.


Setting up a multi-signature Bitcoin address with Mycelium

Mycelium does not yet offer that feature:

https://www.reddit.com/r/Bitcoin/comments/41hzan/is_there_a_way_to_sign_a_multisig_transaction/

There are some mobile wallets that offer multisig now:
https://bitcoin.org/en/choose-your-wallet


Redeeming a raw transaction step by step example required

Step-by-step description:

We start creating a new transaction which we hash and sign.

Add four-byte version field: 01000000
One-byte varint specifying the number of inputs: 01
32-byte hash of the transaction from which we want to redeem an output (reverse order): be66e10da854e7aea9338c1f91cd489768d1d6d7189f586d7a3613f2a24d5396
Four-byte field denoting the output index we want to redeem from the transaction with the above hash (counting from zero): 00000000
Now comes the scriptSig. For the purpose of signing the transaction, this is temporarily filled with the scriptPubKey of the output we want to redeem. First we write a one-byte varint which denotes the length of the scriptSig (0x19 = 25 bytes): 19
Then we write the actual scriptSig (which is the scriptPubKey of the output we want to redeem): 76 a9 14 dd6cce9f255a8cc17bda8ba0373df8e861cb866e 88 ac (look to the bottom line line on https://blockchain.info/tx/96534da2f213367a6d589f18d7d6d1689748cd911f8c33a9aee754a80de166be?show_adv=true )
Then we write a four-byte field denoting the sequence. This is currently always set to 0xffffffff: ffffffff
Next comes a one-byte varint containing the number of outputs in our new transaction. We will set this to 1 in this example: 01
We then write an 8-byte field (64 bit integer, little-endian) containing the amount we want to redeem from the specified output. I will set this to the total amount available in the output minus a fee of 0.0001 BTC (128307 - 10000): 23ce010000000000
Then we start writing our transaction's output. We start with a one-byte varint denoting the length of the output script (0x19 or 25 bytes): 19
Then the actual output script: 76 a9 14 a2fd2e039a86dbcf0e1a664729e09e8007f89510 88 ac ( this is transferring funds back to address 1FromKBPAS8MWsk1Yv1Yiu8rJbjfVioBHc )
Then we write the four-byte "lock time" field: 00000000
And at last, we write a four-byte "hash code type" (1 in our case): 01000000

OK, the result is

01000000
01
be66e10da854e7aea9338c1f91cd489768d1d6d7189f586d7a3613f2a24d5396
00000000
19 76 a9 14 dd6cce9f255a8cc17bda8ba0373df8e861cb866e 88 ac
ffffffff
01
23ce010000000000
19 76 a9 14 a2fd2e039a86dbcf0e1a664729e09e8007f89510 88 ac
00000000
01000000

Now we double-SHA256 hash this entire structure, which yields the hash 1cde0239b55717cca8003104abc2ec2673d4f6fabea0b74351940e382e88486f
Now we should create ECDSA signature...
1MBngSqZbMydscpzSoehjP8kznMaHAzh9y is a brainwallet of "mrbubbymrbubbymrbubby!", which just happens to encode an address starting in 'MB' (making linking the 2 quite easy; see @WizardOfAussie comment below for phrase origins).
Private key in WIF: 5HvofFG7K1e2aeWESm5pbCzRHtCSiZNbfLYXBvxyA57DhKHV4U3

In hex, the private key is 0ecd20654c2e2be708495853e8da35c664247040c00bd10b9b13e5e86e6a808d. There is a sign (key, digest) method in every crypto lib. It will return an array of bytes. This array will be no more than 72 bytes, and start with hex code 30. Lets imagine that the signature is 3046022100cf4d7571dd47a4d47f5cb767d54d6702530a3555726b27b6ac56117f5e7808fe0221008cbb42233bb04d7f28a715cf7c938e238afde90207e9d103dd9018e12cb7180e
 To this signature we append the one-byte hash code type: 01. The public key for 1MBngSqZbMydscpzSoehjP8kznMaHAzh9y is: 042daa93315eebbe2cb9b5c3505df4c6fb6caca8b756786098567550d4820c09db988fe9997d049d687292f815ccd6e7fb5c1b1a91137999818d17c73d0f80aef9

We construct the final scriptSig by concatenating: <One-byte script OPCODE containing the length of the DER-encoded signature plus the one-byte hash code type>|< The actual DER-encoded signature plus the one-byte hash code type>|< One-byte script OPCODE containing the length of the public key>|<The actual public key>

scriptSig will be

49 3046022100cf4d7571dd47a4d47f5cb767d54d6702530a3555726b27b6ac56117f5e7808fe0221008cbb42233bb04d7f28a715cf7c938e238afde90207e9d103dd9018e12cb7180e 01
41 042daa93315eebbe2cb9b5c3505df4c6fb6caca8b756786098567550d4820c09db988fe9997d049d687292f815ccd6e7fb5c1b1a91137999818d17c73d0f80aef9

first line is 'push signature concatenated with 01', second line is 'push pubkey'. The length of scriptSig is 140 bytes (0x8c in hex)

We then replace the one-byte, varint length-field from step 5 with the length of the data from step 16. The length is 140 bytes, or 0x8C bytes: 8c
And we replace the actual scriptSig with the data structure constructed in step 16.
We finish off by removing the four-byte hash code type we added in step 13, and we end up with the following stream of bytes, which is the final transaction:

01000000
01
be66e10da854e7aea9338c1f91cd489768d1d6d7189f586d7a3613f2a24d5396
00000000
8c
49 3046022100cf4d7571dd47a4d47f5cb767d54d6702530a3555726b27b6ac56117f5e7808fe0221008cbb42233bb04d7f28a715cf7c938e238afde90207e9d103dd9018e12cb7180e 01
41 042daa93315eebbe2cb9b5c3505df4c6fb6caca8b756786098567550d4820c09db988fe9997d049d687292f815ccd6e7fb5c1b1a91137999818d17c73d0f80aef9
ffffffff
01
23ce010000000000
19 76 a9 14 a2fd2e039a86dbcf0e1a664729e09e8007f89510 88 ac
00000000


Which version of the JSON-RPC protocol does Bitcoin use?

A little of both:

//
// JSON-RPC protocol.  Bitcoin speaks version 1.0 for maximum compatibility,
// but uses JSON-RPC 1.1/2.0 standards for parts of the 1.0 standard that were
// unspecified (HTTP errors and contents of 'error').
//
// 1.0 spec: http://json-rpc.org/wiki/specification
// 1.2 spec: http://groups.google.com/group/json-rpc/web/json-rpc-over-http
// http://www.codeproject.com/KB/recipes/JSON_Spirit.aspx
//


How to anonymously and privately purchase Bitcoin through Tor?

First of all, anonimity and privacy are two different things. Bitcoin is designed to be pseudonimous - which is close to anonimity, but instead of being completely anonimous, you're linked to your bitcoin address, or pseudonym.
You cannot make a private transaction on the Bitcoin network, but you can try to be as anonymous as possible.

It is possible to run Bitcoin Core as a Tor hidden service, and connect to such services.
The first step is running Bitcoin Core behind a Tor proxy. This will already anonymize all outgoing connections, but more is possible.

More instructions at github:
https://github.com/bitcoin/bitcoin/blob/master/doc/tor.md


For macOS: /Users/arshbot/Library/Application\ Support/Lnd/


A theoretical low cost attack scenario in PoW currencies

Where is the fault, in the attack scenario or in the assumptions?

The fault lies that you've discounted the opportunity cost it takes for an adversary or a conglomerate of miners to subvert the chain by forking off from some prior block. The key here is that there is inherent cost to forking the blockchain at some arbitrary height and re-creating the blocks. The cost can be formularised as block subsidy + total transaction fees in the number of blocks an adversary wishes to re-produce.

Firstly, honest miners will not be party to this, because they'd have to forgo their prior earnings and do double the work to re-earn the difference in your promised bribe transactions fees, so the conflict transaction you intend to bribe the miner with must be so great that it has to be double (at least) block subsidy + total transaction fees * N. Where N is the total number of blocks you want to re-organise. More importantly, what is it that the attacker seeks to achieve by donating away such a large sum worth of bribes (is it actually incentive-compatible to do so)?

Secondly, Assumption 3. simply does not make much sense as it lacks incentive compatibility. As you have shown, sure a miner can perform a naked short on an exchange before colluding to perform your described attack, there is risk to undertaking such a trade as an exchange out of popular interest can renege or withhold payments to a colluding miner that undertakes such a transaction. Simply put, it is more incentive-compatible for miners to mine transactions in an honest manner.


How does a light node know which block its transaction got included in?

Most SPV wallets use BIP 37. The protocol defined in BIP 37 is roughly as follows:

Wallet sends to a full node a bloom filter which, when applied to transactions, indicates whether a transaction applies to that wallet.
Full nodes, for every block and transaction, applies the filter to see if there is a match.
If there is, relay the transactions to the wallet.
If there is a match for a transaction in a block, generate a merkle proof and send the proof with the transaction to the wallet.
Update the filter on matches.
When blocks are received, send the block header to the wallet.

This is generally how all SPV wallets work too, even ones that don't use BIP 37. They may not use bloom filters, but they use some kind of filter and rely on a full node to check things against the filter and then send along the things that match.

For privacy reasons, the filters do not match exactly. They have a false positive rate (but not a false negative rate) so some things are sent to the wallet that do not apply to it. The wallet just ignores those things.

  Also, say a wallet program was loaded after a month of inactivity. Now the wallet needs to know the balance of its address? How does it go about reconstructing its balance after downloading the latest block headers?

It connects to a full node, sends it the filter to use, and then asks the node to send all of the transactions that match that filter that are in all blocks since block X where X is the latest block header the wallet has.


Destination address(es) when redeeming an HTLC

The inputs of a transaction have absolutely no ability to effect the outputs in any situation. They can only define who can spend, not the conditions for how they go about spending it.


With Ripple, how is base fee (transaction fee) calculated?

The base fee is contained in the ledger and can only be changed by a pseudo-transaction that gets into the consensus set. It's managed by consensus the same way the reserve levels are.


Is it plausible to make a decentralized rendering farm by creating a new cryptocurrency?

No.

A proof of work is a piece of data which is difficult (costly, time-consuming) to produce but easy for others to verify. You might be able to squeeze a render job into those constraints (remember, easy to verify also means it needs to be easy (small) to download, otherwise it's already a DOS opportunity right there).

However, another PoW requirement is that the work must be progress-free, which means every iteration of the work is completely independent of all other iterations (like rolling dice). This is because if you have 10% of the capacity, you'll win 10% of the time. As soon as there is progress in the work (20% done, 50% done, 99% done ... 100% done) then the fastest render farm will win 100% of the time (defeating the whole purpose of PoW). That situation also opens up all kinds of exploits where a fast farm can work ahead on the next block and gain an even bigger advantage.

There are many aspects to being progress-free. Even the current bitcoin PoW has a little bit of progress in practice (the block propagation itself) and even a little bit causes centralization pressure: bigger farms have a slight advantage over smaller farms.


At this point in time only one person, Nefario, knows for sure why GLBSE closed.  He was the one who had the power to close it, and he did so, without giving any public explanation.

Everything else is either hearsay or speculation.


How net earners got their incomming channels?

Merchants get channels from customers who want to transact with them. This isn't something that needs to be specified; if someone wants to transact with you over LN, they can open a channel with you. This is how many transactions currently happen over LN - the customer opens a LN channel with the receiver. Furthermore, autopilot modes like the one used by LND will automatically open and close channels to various nodes so nodes that accept incoming channels will likely have connections from others where autopilot connected to it.


What are the key differences between different ways of embedding messages in the blockchain?

There are multiple places one can embed messages in the block chain. Any field that takes arbitrary values can be used.

Nonce - nonce is a field in the header that can take 4 bytes of data. Not the best place to embed much, but it does not bloat the block size
Coinbase string - probably the best place to embed messages. It takes an arbitrary length and doesn't have to adhere to any rules. Main problem is that there is only one coinbase string per block, which usually means one would have to mine the block oneself in order to encode the string. Another important thing to note is that one should not use the exact same coinbase string all the time, as it might make the output irredeemable (if the transaction hash is duplicated)
Transaction outputs - The Tx message outputs can be used to encode messages in the form of output addresses and possibly Bitcoin transfer amounts. This can create irredeemable transactions (if the transfer amount is higher than 0). The overhead of encoding transactions in this way is not too big, in case of 0BTC transactions it would be 10 wasted bytes for about 23 bytes sent (total transaction size is about 33 bytes).
Transaction script - Probably the best way to encode messages, although it is not widely supported (requires custom transaction script creation). Messages are created by adding two script operations - OP_PushData and OP_Drop in the output script of any transaction, and adding the message body in between the two operations. In order to embed messages in this way one would add just a couple bytes in order to send fairly large body of text.

One could also try creating partial SHA collisions that would encode to some short message, although this method would require a lot of computing, yielding short message encoding.


How long does it take to download the blockchain? It's been over a day and still going

You probably don't want to download the blockchain

The blockchain currently weighs in at about 144 GB (check current size)
Assuming you have solid 2 megabytes per second download speed, it would take around 20 hours just to download them.
In practice, this takes much longer, as your computer will verify every block individually, which takes some time.

Also, if you're not doing any mining, it may be wise to look into a lightweight client such as MultiBit or Electrum.


Why are all redeem scripts standard, but only a few pubkey scripts?

Due to the nature of of how redeem scripts are used, there is never any reason for a redeem script to contain anything more than simple constant values.  When an output is redeemed, the redeem script is pre-pended to the encumbrance script, and run as a single script.  Consider a transaction output that is encumbered by a script that says (in pseudo code):

+ 3 == 5

This output could be redeemed by by any script that leaves a 2 on the stack after executing.  That means it could be redeemed by scripts like 3 - 1 or 8 / 4.  However, there is no reason for the additional calculation.  Since  a redeem script only need to leave 2 on the stack, we can simply use a script that just puts 2 on the stack.

This means that any redeem script that performs calculations rather than just placing constants on the stack serves no purpose, and was probably broadcast as an attempt at a denial of service.  These scripts can be disallowed without having any negative effect on the utility of the Bitcoin network.

By contrast, limiting the variability of encumbrance scripts limits what the Bitcoin network can be used for.  This is a topic that has been hotly debated, but in general, the community does not wish to limit Bitcoin's usefulness for future applications.


Mining income calculation - H/s, MH/s or GH/s for hashing power?

You need to put in the hashrate you have \ planning to have. The hashrate depends on the hardware and hash function.

For example, this Bitcoin mining device gives 16 TH/s, which is 16,000 GH/s - https://halongmining.com/shop/dragonmint-16t-miner/.

For GPUs, there are tables online that can give estimates for hashrate of GPU/function combinations, e.g. https://miningchamp.com/.


Bitcoin public keys from uncompressed to compressed version with code sample

Check out these two Python methods taken from here

class PublicKey

@classmethod
def decode(cls, key: bytes) -> 'PublicKey':
    if key.startswith(b'\x04'):        # uncompressed key
        assert len(key) == 65, 'An uncompressed public key must be 65 bytes long'
        x, y = bytes_to_int(key[1:33]), bytes_to_int(key[33:])
    else:                              # compressed key
        assert len(key) == 33, 'A compressed public key must be 33 bytes long'
        x = bytes_to_int(key[1:])
        root = modsqrt(CURVE.f(x), P)
        if key.startswith(b'\x03'):    # odd root
            y = root if root % 2 == 1 else -root % P
        elif key.startswith(b'\x02'):  # even root
            y = root if root % 2 == 0 else -root % P
        else:
            assert False, 'Wrong key format'

    return cls(Point(x, y))

def encode(self, compressed=False) -> bytes:
    if compressed:
        if self.y & 1:  # odd root
            return b'\x03' + int_to_bytes(self.x).rjust(32, b'\x00')
        else:           # even root
            return b'\x02' + int_to_bytes(self.x).rjust(32, b'\x00')
    return b'\x04' + int_to_bytes(self.x).rjust(32, b'\x00') + int_to_bytes(self.y).rjust(32, b'\x00')


How to generate new wallet address per token

I finally found a solution. here is the function to get tone address per token:
try:
    addressjson=gateway.getaddressesbylabel(token)
    address=list(addressjson.keys())[0]
except:
    address=gateway.getnewaddress(token)
return address

this way if an address assiciated to the label: token exists we use. Otherwise we generate a new address with label token.


Help With Gitian-Builder - Failed to load "rcfile"

This question is a bit old now but the solution(s) are still valid. I have found that the most difficult part of getting gitian builder working is the setup of LXC. Apparently it is still valid to use the KVM method but I have never done this and from what I understand, KVM is the old method. Be sure to carefully read over the entire build instructions at https://github.com/bitcoin-core/docs/blob/master/gitian-building.md and any pages it links to for a full understanding of how this all can be done.

Assuming that you have LXC setup correctly, there are also a  couple problems with your build cmd. Here is what you were using:

sudo ./gitian-build.sh --build achow101

and if using the gitian-build.sh script, you should be using this syntax instead:

./gitian-build.sh --detach-sign --no-commit -b achow101 0.17.1

Root access is not required or desired for the build procedure so remove the sudo keyword.
achow101 is the github username you wish to create sigs for. if you aren't planning to upload or do anything with your sigs then it doesn't matter what you enter here as long as it has a value.
0.17.1 is the version tag that you would like to build. You can use gitian-builder to build wallets for older versions of bitcoin so you need to specify which version you want. 0.17.1 happens to be the most current bitcoin wallet tag version as of this writing. You can find the tag versions here: https://github.com/bitcoin/bitcoin/tags. You must always be sure to omit the v prefix since for some silly reason the script wants to automatically add the prefix itself, so if you tried to run ./gitian-build.sh --detach-sign --no-commit -b achow101 v0.17.1 it would error out on trying to download the tag vv0.17.1.

The other big thing to note here is that the gitian-build.sh bash script was replaced by a python script gitian-build.py right around the same time that you posted this question. Therefore, if you are using one of the newer builds of bitcoin core with the new python script you will have to change the build cmd ever so slightly:

./gitian-build.py --detach-sign --no-commit -b achow101 0.17.1

Final note: I don't have a proper list of error msgs, but in my experience there are 2-3 errors that you can intermittently get during gitian building that will stop the build process even when everything is correct. This can be very frustrating when you are trying to learn to build wallets and I have not yet found the reason for this. The workaround is easy, just run the exact same cmd again and 99% of the time it works fine the 2nd time even though it gave an error before.


How did transaction malleability/DDOS attacks allow an exchange's internal accounting system to get "out of sync"?

I'll assume that MtGOX are being truthful here, to avoid undermining OP's question. Transaction malleability was absolutely an issue around the time. It affected a number of implementations, from BitcoinJ, to older bitcoin nodes.

The operator of http://faucet.xeno-genesis.com/ also informed me his service had huge issues around the time of the malleability bot.

The confusion that can occur in a wallet is like this: Imagine your node hears about a transaction with ID A, paying into your wallet. But, imagine this transaction was malleated, and the original was the one to be confirmed. Your wallet has no knowledge of this.

All transactions refer to unspent transactions, and although a various copies of a transaction transaction can exist temporarily in different parts of the world, eventually only one will confirm. We know inputs can only be spent once.

Some implementations might not handle this correctly. Imagine trying to spend a Tx that didn't exist, maybe your customer wants to withdraw BTC? It would fail if you don't check if newly published blocks have transactions that conflict with unconfirmed transactions. You could observe two transactions spending the same input, so you'd take the confirmed one as valid.

MtGOX also would have had issues sending coins they received before the attack. The reason is, if they broadcast their transaction, and a malleated copy ended up in the blockchain, they would assume it failed to confirm, so the customer can try again. Maybe even using other inputs! This cycle could have been repeated by one attacker over and over draining the wallet.

Another possible issue is that if they did correctly believe the transaction went through, but still tried to spend the incorrect TxID, then that transaction would fail, causing panic from the customer.

Wallets which sent a high number of transactions during the attack were most affected.


If you have the private keys for your addresses that were holding your bitcoin, transfer them immediately to a new address. On the compromised computer, cease all online work until you are certain the phishing malware has been removed.

If they have already been removed by the thief, then there is not much you can do. You can file a police report, but the likelihood of getting your coin back is about the same as if someone stole your physical wallet out of your pocket.

In theory, there is a lot more you can do, but the justice departments of the world have not laid down any protocols for bitcoin theft and are likely never really investigated (most cops probably don't know much more than the average person about bitcoin, anyway).


BIP 34 (the BIP that specifies block version 2 and block heights in coinbases) is not activated on regtest and is never activated.

  How do block versions work in regtest mode?

Block versions are actually version 0x20000000, not version 1. This version allows for other soft forks like BIPs 65 and 66 be activated. Some other forks (BIP16, CSV, and Segwit) are activated by default, and BIP 34 is disabled.

  Can I configure them?

Yes, use the -blockversion command line option when starting bitcoind

  Do I need to mine a specific number of blocks?

For BIP 34, no, you can't activate it without changing the software.


Will the decreasing Bitcoin production cause a liquidity crisis?

Bitcoin's reward rate isn't constant - it halves every 4 years, and eventually stops entirely in 2140.

https://en.bitcoin.it/wiki/File:Controlled_supply-supply_over_block_height.png

See also: The End of Mining


How to fund an account in a Stellar private network?

Visit: https://galactictalk.org/d/735-is-it-possible-to-build-my-own-blockchain-private-blockchain-on-stellar/2

The stellar network doesn't use mining. It doesn't even have "blocks". I'm not sure what exactly you are looking for.
When you start a private network you get the root account key in the logs with 100 billion Lumens. It should work like the public network. If you want to remove the need for Lumens you would need to modify the software.


Can I find out on which website I got my Litoshi address?

Look at a list of Litecoin web wallets to see if any one them sound familiar to you:

LiteVault - Online Litecoin Wallet; private keys encrypted locally
Hive Web Wallet - Online BTC/LTC wallet; private keys encrypted locally
Liteaddress.org - Litecoin address generation tools (BIP38)
Reddit LiteTip Bot - Give and receive Litecoin tips from reddit users
Coinkite - Coinkite is a web wallet with merchant services, Point-of-Sale
terminals and debit cards.
CoinWallet.co - Online wallet
Harborly - Online wallet that can be linked with any US bank account
HolyTransaction - Online wallet, multi-currency support
Celery - Online wallet
Cryptonator - Multi coin wallet

https://litecoin.info/Category:Services#Wallet_services

If you are able to locate your account, please send your LTC to an offline wallet with a strong password that you do not use on multiple sites.

Web wallets are not the most secure and your practice of reusing passwords on many websites is a horrible security practice.


Long term cost of using cryptocurrencies

I see what you are trying to convey. What is the cost of doing business in the Bitcoin compared to doing business with say the US Dollar? The Dollar was never designed to be ported into an international digital spectrum. It requires a massive support network of banks, regulations, payment processors and international agreements to permit Online commerce, but even then it suffers from fraud and sovereign manipulation.

The Bitcoin resolves a huge set of issues the dollar suffers from at the cost of global transaction verification and the risk of a deflationary spiral. In short, no one can legitimately assert to fully understand the impact of the Bitcoin and its long term use. It's an experiment.

I would encourage you to take my course on Bitcoins on Udemy when I finish it at the end of this week. Send me an email at Charles.Hoskinson@gmail.com if you're interested.


Should the Policy to Miniscript compiler(s) be considered as deterministic and is this the end goal?

The mapping between Miniscript and Script will never change. (At least, not without a major version bump of this library and at this point, probably a "Miniscript 2" which is billed as a different language.)
The mapping from Policy to Miniscript may change even between successive runs of the compiler.  Currently, the Miniscript compiler produces the most optimal compilation in terms of average satisfaction costs but the compiler internal uses non-deterministic HashMap traversal. It might produce two different compilations of the same average satisfaction cost. So it is not advised to rely on the Policy compiler producing the same results. Even the C++ and Rust implementations may differ in actual Miniscripts but will have same average satisfaction costs.
In the future the compiler could be improved and Miniscript extended. In addition there may be auxiliary information someone has that changes the optimal script but doesn't fit in the currently accepted Policy compiler. Policy language and the current compiler should be seen as a demo and not the final authority on declarations of Miniscript. The real value of Miniscript comes with being able to reason about arbitrary scripts that people give you regardless of how they came up with them. If you reduce that to needing the Policies they were compiled from you're massively restricting its possibilities.
There is a concern that the ecosystem comes to implicitly rely on knowing Policies in this quick and dirty Policy language and a compiler can't evolve because of it. The end goal should be eventual interoperability and the the layer at which things interact should be Script/Miniscript not Policies.
This question was answered by Sanket Kanjalkar, Pieter Wuille and Andrew Poelstra on ##miniscript on IRC but has been paraphrased. Any errors are my own (and I will gladly correct).


Chain with most proof of work - hash target or block header hash?

It's the sum of difficulty targets, not the individual difficulty scores. Therefore, two blocks at the same blockchain height are always the same cumulative difficulty¹.
If it were individual difficulty scores, it would make chaintips more gameable, e.g. a block with a particularly low hash might prompt a selfish mining attack because the attacker could expect that their chaintip will outdo another even when they reveal the block later, or miners might continue mining at the same height because an already discovered block barely met the difficulty statement. In other words, the blockchain would converge less reliably if it was based on individual block scores.

¹ Unless we're in a longer blockchain fork across a difficulty reset which changed the difficulty by different amounts for the two chaintips.


Why is there no forced signaling during the LOCKED_IN phase of BIP 8(LOT=true)?

The state transition diagram of BIP 8 is here.
The specific change you refer to was made in this BIP PR by AJ Towns. Once we move into the LOCKED_IN phase of BIP 8 the soft fork is definitely going to activate at some point and so any requirement to signal is unnecessary. The MUST_SIGNAL phase makes it clear to the network that signaling is being enforced by the network. In the LOCKED_IN phase (which only begins after a difficulty adjustment period, 2016 blocks, where the threshold of signaling has been met) it is clear to the network that the soft fork rules will be enforced in future.


The cpu is not used while mining and thus should not bottleneck your setup. The only impact that I could see would be bootup times, and it shouldn't be significant.


Can I speed up the running of functional tests?

The Bitcoin Core test README states:

By default, up to 4 tests will be run in parallel by test_runner. To
specify how many jobs to run, append --jobs=n
The individual tests and the test_runner harness have many
command-line options. Run test/functional/test_runner.py -h to see
them all.

Pieter Wuille also explained how he gets the total time down below 4 minutes on GitHub:

You can run them in parallel; if you have sufficient RAM pretty extremely even. test_runner.py -j60 works fine on my 4-core 32 GiB RAM system, taking 3m46s. A lot of the time consists of processes waiting for each other, so it's not actually CPU bound.


any website tracking history of circulating tokens of any coin?

If you have a look on blockchain.info, you can type in the block number to bring up this page for block# 510223 for example.

In that block, the first transaction is the coinbase transaction for the block reward (No Inputs (Newly Generated Coins)) and the output is the recipient address.

Note that you should wait until a block has six confirmations before you consider it final (is buried under six additional blocks).


how to sign a multiple output transaction

Just call to multiple times:

            .from(txoSet)
            .to( userAddress, amountTotransfer)
            .to( userAddress2, amountTotransfer2)
            .fee(10000)


What is the probability of different public key hash that produce the same checksum value

Yes, exactly 1/2^32.
There isn't much more to say about it. Hashes of distinct values are uniformly randomly distributed. The chance for two independently uniformly randomly distributed hash to match in 32 bits is 1/2^32.


What is the strategy mining pool servers use (regarding difficulty)?

It depends on the pool. Some pool use a fixed difficulty. Some use several and allow users to choose. Some automatically set the difficulty, with the aim that each miner generates a share every few seconds.

If the difficulty is too low, network traffic is too high (and some miners, such as the antminers, cannot generate more than 40-50 shares/s, regardless of the difficulty).

If the difficulty is too high, then miners generates shares too infrequently, and it may lead to a lost of efficiency, because the job changes every 10 minutes (each time a new block is mined).


How to read the asset quantity list of open asset protocol?

According to the Open Assets Protocol Spec, the amounts are encoded in something called the unsigned LEB128 encoding. So for 300 the binary looks like:

100101100

You have to pad to a multiple of 7 (we have 9 bits, so this becomes 14):

00000100101100

Now split into groups of 7:

0000010 0101100

Add in a 0 bit for the very first one, and 1 for every other group of 7:

00000010 10101100

In hex, this is:

0x02 0xac

Put this in Little Endian order:

0xac 0x02

You can do the same for the 624,485 number and get the 0xe5 0x8e 0x26.


Do miners participating in pools pay a transaction fee?

The sender always pays the transaction fee, so it is the mining pool operators that pay the transaction fee. Of course since they control a mining pool, the mining pool operator can just have their pool mine the transaction and thus not have to pay any transaction fees. This is a fairly common occurrence.


Are Bitcoin and Litecoin test addresses compatible?

Yes, they're interchangeable.

The components of an address are a prefix byte, a 20-byte public key hash (160 bits), and a 4-byte checksum.  Litecoin testnet uses the same prefix byte as Bitcoin testnet (hex 0x6f, decimal 111) and computes the hash and checksum in the same way.  This was arguably not a good decision on the part of the Litecoin developers, but we are sort of stuck with it now (maybe until testnet4).

If you have the private key for the address in your Bitcoin wallet client, it should in principle be possible to export it from there and import it into your Litecoin client (they also both use the same prefix byte for testnet private keys).


Miners receive a block subsidy and any transaction fees in the block.

The subsidy started at 50BTC and halves every 210,000 blocks. See Mining Reward. These are newly minted coins the network accepts as valid coins based on consensus rules above.


BitPay / Copay's Weird Bitcoin Cash Address Format

It's a new address format for Bitcoin Cash proposed by BitPay, to prevent BTC/BCC address confusion. It's not widely used, currently.

The old addresses that start with 1 (P2PKH) are converted to addresses that start with C
The old addresses that start with 3 (P2SH) are converted to addresses that start with H

You can use this "address translator" to translate the addresses: https://bitpay.github.io/address-translator/

References:

BitPay blog post: https://support.bitpay.com/hc/en-us/articles/115004671663-BitPay-s-Adopted-Conventions-for-Bitcoin-Cash-Addresses-URIs-and-Payment-Requests


The Speculation board on the BitcoinTalk forum is nonstop speculation.  That would probably be the best place to share your theories and analysis and to collaborate. Enjoy!.

There is a fair amount of discussion that falls under the category of speculation that also occurs on the #bitcoin-otc IRC channel.

And /r/bitcoin on Reddit seems to get its share of "OMG $30 Soon!" posts.


Why can't I see my transactions on Blockchain.com?

My assumption would be that this is due to the way coinbase handles deposits.
You can tell more of the story by grabbing the transaction details from their website.

Click on the transaction in the Accounts section and look for the "View transaction" link and it will take you to it.


You have two options to get set up on a Signet. One is to set up your own independent custom Signet that you can control. The other option is to use the default Signet set up and administered by Kalle Alm and AJ Towns. I will focus on the latter here.
Currently as of the time of writing (August 2020) the Signet PR has been merged into Bitcoin Core, but is not in a release yet, which means you need to compile Bitcoin Core's master branch yourself.
Build instructions for Bitcoin Core are here (Windows, Mac OS, Linux).
Once you have successfully built the master branch you should be able to use the -signet flag e.g.

./src/bitcoind -daemon -signet

./src/bitcoin-cli -signet getnewaddress

To obtain some Signet Bitcoin there is a Signet faucet here: https://signetfaucet.com/
You can track Signet transactions with the Signet block explorer here: https://explorer.bc-2.jp/
For more details see Kalle's workshop at Advancing Bitcoin 2020 that shows you how to make Taproot transactions on Signet and debug Taproot scripts using Kalle's Bitcoin script debugger btcdeb. (Beware that the workshop is from before Signet was merged into Bitcoin Core, so some of the details are outdated.)


How Do I Redeem Bitcoin for USD Currency?

As we know bitcoin as an independent currency is traded in open markets (virtual or physical ones). So, you can sell/buy bitcoins for USD or any other cryptocurrency, fiat currency or even goods and services directly. For example, you can use localbitcoins.com to trade your bitcoins with people who are willing to pay cash for it. Another example is to use Bitpay Card (bitpay.com) allows you to accept bitcoin, store and spend bitcoin securely, or turn bitcoin into USD with the BitPay Card. There are many more.

More importantly, bitcoin is a currency that can be used for purchases directly without the need to convert it into Cash. For example, you can use it to buy goods from overstock.com, purse.io, amazon gift cards, etc ...

I hope that helps.


Electrum does not download the whole blockchain. I would recommend giving it another try as it should be pretty much as fast as any other app. One thing you could try is switching the validation server. This would possibly increase the speed at which you are able to sync up.

About electrum validation:
"This wallet uses SPV and random servers from a list. This means little trust in third parties is required when verifying payments. However, it is not as secure as a full node like Bitcoin Core."

Information above taken from: https://bitcoin.org/en/choose-your-wallet

The above resource should help you pick another wallet besides electrum if you choose to do so.


What happens when two transactions send to the same address?

It works just fine.

Bitcoin transactions can have multiple inputs and outputs; each input is a "pointer" to an output of a previous transaction (specifically, it consists of a transaction id and output index). So you  would create a new transaction with two inputs:

the A1->A3 transaction (or more properly, the particular output of this transaction that credited A3)
the A2->A3 transaction (again, the particular output).

It's not necessary to include amounts in the inputs, since the rule is that each input must be consumed completely.  So we now have 3 BTC worth of inputs in our transaction.

An output consists of an amount and a destination address. (One can also have a script which directs the payment in more elaborate ways, requiring multiple signatures, etc, but let's ignore that for now.)  You would want to have two outputs:

An output paying 2.5 BTC to the desired destination address, call it A4
An output paying the "change", 0.5 BTC, to some address of yours.  You could use A3 again, but it is generally better to use a newly generated address; call it A5.

(Actually, in real life, the second output would more likely be something like 0.4995 BTC.  The leftover 0.0005 BTC wouldn't appear in any output; it would be a transaction fee, collected by whichever miner includes this transaction in a block.)

For an end user, this is all done under the hood by their wallet software.  The user just specifies that they want to pay 2.5 BTS to A4, and the software takes care of identifying appropriate transactions to use as inputs and creating the necessary change output.  Sometimes this confuses people when they see that after the transaction, the balance in A3 has dropped from 3 to 0, if they don't know that the remaining 0.5 BTC has gone to a new address A5 which is still theirs.


You cannot import private keys to the keypool. This is currently not allowed because it is generally regarded as unsafe, at least with the way that the wallet works today. There is ongoing work to change this in the future.

You could do a split wallet setup where you have a watch only wallet with the pubkeys imported into the keypool and use that for address generation and transaction creation. Then you have a wallet with just the private keys imported and you use that for signing. But that's not what you want.

If you aren't tied to using a BIP 39 seed, you could generate a 256 bit seed and use sethdseed to set the HD seed of a wallet. That would do what you want, but BIP 39 uses 512 bit seeds and not 256, so it won't work there.

Imported addresses are never automatically used when you do getnewaddress. When you import them, you need to set keypool: "true" for each imported object for that to work.


How to import a private key to an encrypted wallet (on standard client)

Since 0.6.0, key import/export are available in the client itself, though only through RPC. The commands are called dumpprivkey and importprivkey. For example (on testnet):

  $ ./bitcoind getnewaddress

  n2JjZgLeCUgfubswxDm9zAaBGSLLHSLdNv

  $ ./bitcoind dumpprivkey n2JjZgLeCUgfubswxDm9zAaBGSLLHSLdNv

  cR4RtpaeAZY8MwrNvTQGX9PZ9pdCgFoLxuo4Pkwqx61broC4Gb4y

And on another wallet:

  $ ./bitcoind importprivkey R4RtpaeAZY8MwrNvTQGX9PZ9pdCgFoLxuo4Pkwqx61broC4Gb4y

  $ ./bitcoind validateaddress n2JjZgLeCUgfubswxDm9zAaBGSLLHSLdNv

  {
      "isvalid" : true,
      "address" : "n2JjZgLeCUgfubswxDm9zAaBGSLLHSLdNv",
      "ismine" : true,
      "pubkey" : "029e3a934cfc9f89d7a1c15f99b98479cabc81964f4972e7b8fa3989a788261695",
      "iscompressed" : true,
      "account" : ""
  }


I am web developer, can i use my working pc to mine and work at same time?

That would be possible but probably not profitable.

If you use your GPU to mine BTC the costs for electricity are most likely higher than your gains from mining.

I don't know if GPU mining is profitable for ETH. That also depends on where you live and what you have to pay for electricity of course.


Can i send coins internally to one big wallet?

No.
By internal you mean without communicating with the Bitcoin network and without involving external miners.
All Bitcoin transactions which move money from one set of Bitcoin addresses to another Bitcoin address are external in the sense that they must be recorded on the blockchain and therefore must incur transaction fees.


Your question, “How do I profit from bitcoin?”, suggests that you have read some of the disinformation about Bitcoin that is to be found in the media.

Bitcoin is often described wrongly as an “investment”, which is absurd because it doesn't sell goods and services and therefore cannot generate a revenue stream. Also. you can't build anything on a bitcoin balance, so a property developer's definition of “investment” does not apply either. Bitcoin is just ten years old, and its novelty has attracted speculators, some of who made money by speculating that its price would go up as it grew more popular. You might therefore describe bitcoin as a speculative asset. The Bitcoin White Paper says its purpose is to be electronic cash.

You might speculate that its price is going to go up from its present value, but seeing as you freely acknowledge that you don't understand it, your speculation would be pure guesswork — gambling in fact. Among those who do understand Bitcoin, some expect its price to go up, and some expect its price to go down. Whom do you believe?

So, successful speculators have profited from bitcoin, and unsuccessful speculators have suffered losses. Can anyone else profit from bitcoin? I can think of two examples, traders and exchange operators. Successful traders make money from bitcoin using the same techniques that they use to make money from the forex markets, the stock markets, the oil market and so on; but very few people have the skill and self-discipline to trade profitably. If you don't have a solid understanding of derivatives in some other market, you're unlikely to succeed as a bitcoin trader. Bitcoin exchange operators make their money by providing a similar service to the people who run stock exchanges: they earn fees for connecting buyers and sellers.

If you don't own any bitcoins, and you're thinking of buying, I suggest you hold back until you've got your head around the following:— The statement “I own 0.25 bitcoins” is really just a short way of saying “I have a private key that lets me sign withdrawal transactions affecting a Bitcoin address where the present balance is 0.25 bitcoins.” (The 0.25 might be spread over multiple addresses, but you get the idea.)

You say you want to “get a clear sight on how this thing works”, so here's another suggestion:— If you can send cryptographically signed emails (and validate the signatures on cryptographically signed emails that other people send to you), then you will be off to a good start. Asymmetric cryptography is an astonishing invention that has changed the world in many ways, with Bitcoin being just one of them.


Errors Connecting to Bitcoind Server with RPC

Bitcoin disallows rpc requests from IP addresses other than 127.0.0.1 Try adding

rpcallowip=<your ip addres>

to your bitcoin configuration file.

More info


I have 23 words of my 24 word mnemonic (and passphrase) for my ledger nano-s, is it possible for me to brute-force the last word (not in order)

There are 2048 words in the BIP39 list, there are 24 possible positions for your missing word.

You need to try 2048 x 24 = 49,152 combinations.

For each one, you need to generate a private key + public key and check whether addresses generated from that have any unspent bitcoin associated with them. You can work with a pruned blockchain and probably further prune based on the known date-ranges of your most recent transactions.

Superficially at least, it seems feasible for an automated process to do this in reasonable time (i.e. less than years).

Having tried all words in one position you should have a reasonable idea of how long this will take.


How could you initiate a new Exchange Market?

As the name "exchange" suggests, an exchange does not buy or sell bitcoins themselves. They merely function as an exchange between sellers and buyers.

So what you will have to do is wait for people to start trading. But people won't come by themselves, so you will have to give users a reason to come to you instead of an existing exchange. It may also help to trade on your own site in the beginning both to not completely rely on new user's transactions and to generate some trade volume.


What is a hash pre-image as it is used for the breach remedy?

In the image below from Rusty Russell's Deployable Lightning paper, you can see a visualization of the commitment transactions and their outputs:

For each payment in a channel, there are two commitment transactions generated, one for Alice and one for Bob.  Both Alice and Bob sign both commitment transactions, so they're both valid transactions (although only one of them could be included in the blockchain since both transactions spend the same inputs).

Both transactions pay two outputs.  The transaction Alice has (on the left in the diagram, Commit TxA) pays the following two scripts:

A regular P2PKH (or its segwit equivalent) output that Bob can spend at his leisure.
An output that Alice can spend after waiting a specified number of blocks (let's say 100), as enforced with OP_CSV, or which Bob can spend if he has a piece of data that hashes to a value in this output.  I call this the pre-image; in other descriptions of Lightning this is a private key used to generate a signature.

In the transaction that Bob has (on the right, TxB) these are reversed, there's:

An output that pays Alice using P2PKH.
An output that Bob can spend after waiting 100 blocks or which Alice can spend at any time using a pre-image.

In these outputs, Alice selects the pre-image that prevents Bob from spending her output (Revocation-A) and Bob selects the pre-image that prevents Alice from spending his output (Revocation-B).  They could use a random number of large size, although they'll probably both use hashes from a hashchain generated using Rusty Russell's 64-dimensional shachain to allow compact storage of any revealed hashes, seeding the chain with some initial random value.

Each time Alice and Bob agree to update the state of the channel, they both reveal to the other person the pre-image for the hashlock they placed on the output for the previous state of the channel, allowing the other person to create a breach remedy transaction.