text:
Why does the Stratum protocol use a Share Difficulty of 2^32?
In the comments below his answer to my recent question about Network Difficulty, Pieter noted that Stratum Share Difficulty is an entirely separate concept.  See https://bitcoin.stackexchange.com/a/121133/142060 where he states:

"Inside the Stratum protocol used for pool mining there is also a notion of (share) difficulty, however it corresponds to exactly 2^32 hashes per block (so it differs from difficulty as used by the rest of the ecosystem)"

To summarize, this means that statistically, mining 1 pool share requires computing 2^32 hashes, on average. 2^32 equates to 4294967296.
By comparison, Network Difficulty at the first epoch (aka Difficulty 1) is defined such that out of 2^256 possible hashes, exactly 0xffff * 2^208 + 1 of them would mine a valid block. (0xffff * 2^208 + 1) / 2^256 equates to 1/4295032833.000015.
Is it pure coincidence that 2^32 (4294967296) is so close to the reciprocal of the Difficulty 1 ratio of valid-to-total hashes (4295032833.000015)? Or was 2^32 chosen as a convenient approximation of this number?
Here is some Python to illustrate:
# Share Difficulty
share_difficulty = pow(2, 32)

# Network Difficulty 1
possible_hashes = pow(2, 256)
valid_hashes = int(b'0xffff', 16) * pow(2, 208) + 1
valid_hash_ratio = valid_hashes / possible_hashes

print(1 / valid_hash_ratio)
# 4295032833.000015

print(1 / valid_hash_ratio - share_difficulty)
# 65537.00001525879

If my theory of 2^32 being an approximation is not correct, does anyone know why it was chosen as Share Difficulty within the Stratum protocol?
Thank you

bitcoin block headers have a field called Bits where the difficulty target is encoded as a 32 bits integer
the lower the target, the more difficult it is to generate a block.
mining shares are regular bitcoin blocks with higher targets (or in other words, they are "weaker" blocks)
the pool needs to establish some kind of "tuning" between what constitutes a minimally accepted amount of work to cross over a payout threshold
that is inherent to the engineering tradeoffs to the pool's architectural design and the finite infrastructure it's running on
in order to define what constitutes minimally acceptable work threshold, there's two fundamental variables at play:

rate of share submissions
share difficulty (how much work each share represents)

if a miner submits shares at a high rate (relative to connection bandwidth with the pool), but the share difficulty is too small (targets are too high, blocks are too weak), the pool could rightfully label these submissions as spam
hopefully, decentralization will lower this bar, and we will have smaller thresholds allowing for smaller miners to participate in PoW without having to resort to "lottery games" to fulfill their ideological motivations
in summary, a mining protocol such as Stratum needs to have some kind of "unit" that represents some minimal amount of work (let's call it minTarget). This unit is represented as a difficulty target, which needs to be relatively high number between 0x00000000 and 0xFFFFFFFF.
since we are encoding difficulty targets with 32 bits, we have a few options:

0b11111111111111111111111111111111: human friendly, but inefficient because results in high traffic for share submission, while past (and current) centralized pool architectures do not have bandwidth nor computational resources to account for the amount of shares that would be submitted by each miner.
0b10000000000000000000000000000000: a trade-off for a human-friendly number that still results in a reasonably efficient bandwidth consumption for share submission

so while using Stratum, the miner can configure their machines in a way that it will only submit a share if it is above N * minTarget.
on the other hand, pools could also choose to refuse shares below M * minTarget because those would consume excessive infrastructure resources (e.g.: bandwidth for share submission, or computation/memory for share accounting) without a meaningful PoW contribution.

another relevant detail (although not exactly an answer to your question):
SV2 Translator Proxies have a configuration parameter where the miner can throttle the total amount of shares (coming from their SV1 machines) that are going to be submitted upstream towards the pool.
that way, even if the farm has many small machines (e.g.: Bitaxe), but its aggregate hashrate is above the pool's accepted minimum, their shares will be more easily accepted and fairly accounted for

Thanks @plebhash for the info. The more I've learned on this subject (outside this thread), the more I am convinced that share difficulty can be set arbitrarily by the pool... but that it is commonly set as some multiple of 2^32. If anyone can point to where share difficulty is set in the stratum V1 codebase, or in an open source mining pool implementation, that would help to validate.

I get what you mean when you say it's an arbitrary decision, it does seem like that at a first glance. But calling it arbitrary could give us the wrong idea, because in the end of the day, this is an engineering-driven design decision. Pools should choose the minimum share difficulty as a function of the total amount of hashrate it aims to accomodate vs the available infrastructure resources. Saying it's 100% arbitrary could lead to inefficient choices (e.g.: excessive bandwidth consumption for share submission, or excessive computation/memory consumption for share accounting)

unfortunately I'm not familiar with the SV1 codebase, so I cannot help you with that

I do not see what this answer has to do with the question. The stratum difficulty is not a 32-bit integer at all, it's a JSON floating-point number. The question is why that represents a multiple of 2^32 hashes rather than difficulty used elsewhere in the Bitcoin ecosystem (where it represents a multiple of 2^48/65535 hashes).


text:
Miners setting timestamps up to 2h into the Future
When a miner adds the Timestamp to a block template, it must satisfy two conditions:

Timestamp must be greater than the Median Timestamp of the previous 11 blocks
Timestamp must be less than its local Network Adjusted Time (current time) + 2 hours

My question is whether a miner could 'postdate' the Timestamp up to 2 hours into the future, and still have the block be accepted as valid by other nodes?  A similar question was asked and answered here:
https://bitcoin.stackexchange.com/a/85621/142060

If a block's timestamp is in the future, it won't be accepted [by other nodes]

However, this answer doesn't specifically address the case of when the Timestamp is within that 2 hour window.  Isn't it true that a node would accept a 'postdated' Timestamp if it was within 2 hours of its local Network Adjusted Time?
If so, what are the implications of a significant percentage of miners doing this?  It seems that miners could artificially increase the trailing Median Timestamp.  Could this be used as an attack vector against other miners running the default getblocktemplate in Bitcoin Core? Specifically, would other miners produce invalid blocks if their Network Adjusted Time is earlier than the Median Timestamp?
Thank you

Yes, the network would accept blocks that are dated up to 2h into the future. If close to or more than half the hashrate generally dated blocks two hours into the future, miners using an accurate timestamp would occasionally see their block rejected because its timestamp would not surpass the median-time passed of the last 11 blocks.
The attacked miners would then probably respond by also dating their blocks two hours into the future and that would be the overall end to the attack.

My question is whether a miner could 'postdate' the Timestamp up to 2 hours into the future, and still have the block be accepted as valid by other nodes?

In validation.cpp for version 23 of Bitcoin core I find
    // Check timestamp
    if (block.GetBlockTime() > nAdjustedTime + MAX_FUTURE_BLOCK_TIME)
        return state.Invalid(BlockValidationResult::BLOCK_TIME_FUTURE, "time-too-new", "block timestamp too far in the future");

MAX_FUTURE_BLOCK_TIME is defined elsewhere as two hours (2 * 60 * 60)
So yes, "valid".
I couldn't find anything else relevant in the code but I'm not a Bitcoin core developer so probably don't look for the right things in the right places.

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
Unable to load 2 year old wallet into Core
The previous Core version used 2 years ago was 19.0.1. I have since then upgraded to 21.1 last year.
The wallet which worked fine with 19.0.1 is no longer loading in 21.1.
The database in up to date and the default wallet(empty wallet for 21.1) is loading fine but the previous wallet is making Core close without error messages. Also tried a few copies of same wallet with same result.
Thanks,
Christian

Are there are any errors logged in the debug.log file? Have you tried a more recent version as 0.21.x is EOL?

I found the solution but it should not be this way. Ver. 21.1 forced me to "Create Wallet" (instead of using the default one directly under the Bitcoin folder) and at the same time creating a new sub folder into which I placed my old wallet and it worked. I also re-imported the privkey to create a brand new wallet on ver. 21.1. I will upgrade to the latest version and we'll see how it goes. Many thanks!

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
what is the best way to store btc for long-term?
I am looking for a way to store btc for long-term.
Have been using airgapped hw wallet but I want to get rid of third party risk at all.
I do not want to use mnemonic anymore as I found that BIP39 is not supported by bitcoin core.
I am thinking of running my own full node+hd wallet+cold storage(dont want to store my seed on any electronic device as it can deteriorate).
I do not need to spend btc often as I hold it for long term. I just want to check if my balance is safe sometimes.
Can anyone recommend how I can achieve this??

That's the question of utmost importance. The state of the art guidelines include generation, encryption and backup copies (on various media, e.g. paper, steel) of private keys (or keychain). Each situation is unique so individual approach must be taken to achieve the best result. Last but not least, human (imperfection/errors) is the weakest link so let's not forget to take care of oneself.
I'd suggest starting with an air-gapped PC with Bitcoin Core to generate keys and handwrite them (in encrypted form) on a paper. Improvements could be planned and implemented iteratively (e.g. another backup copy in steel as the next step).
Recommended reading:

https://cheatsheetseries.owasp.org/cheatsheets/Key_Management_Cheat_Sheet.html
https://www.lopp.net/bitcoin-information.html

wow thank you very much. the attached link is bit difficult to understand.. will go through it slowly. I appreciate it!

Seed Tool may be useful: https://bitcoiner.guide/seed/


text:
Is versionbit 28 on testnet something that can be disregarded?
My testnet node is displaying a value in the getblockchaininfo warnings field related to versionbit 28, which I see referenced in various threads going back years.
The angles I'm trying to address are:

If I'm running the most recent version of core, is it still typical to see unknown rules once in a while? Should this situation be considered an unsupported softfork or something different?

Where can I find out how to support newly activated rules i.e. what actions to take?

Is this only some quirk because Bitcoin Classic forked on testnet (see here)?

Here is some info from bitcoin-cli:
--version
    Bitcoin Core RPC client version v25.1
Copyright (C) 2009-2023 The Bitcoin Core developers

Please contribute if you find Bitcoin Core useful. Visit
<https://bitcoincore.org/> for further information about the software.
The source code is available from <https://github.com/bitcoin/bitcoin>.

This is experimental software.
Distributed under the MIT software license, see the accompanying file COPYING
or <https://opensource.org/licenses/MIT>

-getinfo
Chain: test
Blocks: 2537535
Headers: 2537535
Verification progress: 100.0000%
Difficulty: 85961336.19616741

Network: in 1, out 11, total 12
Version: 250100

getblockchaininfo
...
"warnings": "Unknown new rules activated (versionbit 28)"

Does Impact: unknown rules (versionbit 2) have been activated answer your question?

No, actually.. I'm running the most recent release of Bitcoin Core and versionbit 28 does not seem new, as I've linked a thread referring to it from years back.
Any idea what versionbit 28 refers to or where I can learn about these feature/soft fork signals in general?


text:
What mechanism is used by nodes to link Witness data to its Transaction?
I am stuck in developing an understanding of how a node could go from SegWit TXID to lookup Witness data, or vice-versa.
I see that eventually a witness TXID is calculated and included in a Merkle Tree of all SegWit transactions for a block but I'm unsure if:
(a) this creates the link I'm looking for or...
(b) how you would do so before that Merkle Tree of SegWit transactions is appended to the block.

I am stuck in developing an understanding of how a node could go from SegWit TXID to lookup Witness data, or vice-versa.

This is not a problem that occurs. Unconfirmed transactions (ones not yet in blocks, or kept in the mempool) are indexed by their txid, and the witness data is stored along with the transaction. When a node needs to find the witness data for a given txid, it just looks in its index.

Understood, your time is much appreciated - thank you.


text:
Setup bitcoind and be able to make a call to GetBlockTemplate
I have been able to get bitcoind started by giving it the right data directory and configuration file.  I downloaded and ran rpcauth.py from https://github.com/bitcoin/bitcoin/blob/master/share/rpcauth/rpcauth.py
I am stumped as to what to do next.  I added the rpcauth= line to my bitcoin.conf file.  I have tried various combinations of rpcuser or rpcauth both in the bitcoin.conf file and on the bitcoin-cli command line.
I would like to make bitcoin-cli  getblocktemplate to work so I could better understand what gets returned when one asks for a block to mine.
TIA

In what way does it not work? What error are you getting?

The username/password combination is not valid.


text:
Create a BTC account programmatically
Is that possible to create new BTC(or any other cryptocurrency) account through free api or kind of?

What do you mean by "account"? In Bitcoin and exchanges you have private keys and public addresses. There are no accounts. Do you mean exchange account?

Hi pbies, yes, I mean account for exchanging.

exchange on the Internet = an exchange portal, not exchanging.

You can only create new BTC by mining.

Is that possible to create new BTC [...] account through free api

The Bitcoin network doesn't have accounts, it is a peer to peer network. To receive and send BTC you only need to install wallet software on your computer or phone. You don't need to create any account.

I need to create address, which could send and receive BTC from another addresses

The normal way to do this would be to download some wallet software to your PC and use that to create addresses.
If you must do it using an API, you can choose wallet software that has an API. For example the Bitcoin Core application software has an API that includes
GetNewAddress

getnewaddress ( "label" "address_type" )
Returns a new Bitcoin address for receiving payments.
If ‘label’ is specified, it is added to the address book so payments received with the address will be associated with ‘label’.

It's possible to create an address completely offline.
All addresses exist even if never used in a transaction.
Algorithms needed to generate a new BTC keypair:
 secp256k1
 sha256
 ripemd160
 base58

Hi CS, no, I need to create address, which could send and receive BTC from another addresses, doesnt matter which exactly.


text:
Bitcoin script and unsecure ScriptPubKey
The following is taken from problem 3 in HW1 of CS 251 Stanford's course (https://cs251.stanford.edu/syllabus.html).
Alice is on a backpacking trip and is worried about her devices containing private keys getting stolen. She wants to store her bitcoins in such a way that they
can be redeemed via knowledge of a password P. Accordingly, she stores them in the following
ScriptPubKey address:
OP_SHA256
<0xeb271cbcc2340d0b0e6212903e29f22e578ff69b>
OP_EQUAL

Write a ScriptSig script that will successfully redeem this UTXO given the password P.
Hint: it should only be one line long.

. Suppose Alice chooses a six character password P. Explain why her bitcoins can be stolen
soon after her UTXO is posted to the blockchain. You may assume that computing SHA256
of all six character passwords can be done in reasonable time.

Suppose Alice chooses a strong 30 character passphrase P. Is the ScriptPubKey above a
secure way to protect her bitcoins? Why or why not?
Hint: reason through what happens when she tries to redeem her bitcoins

My attempts/doubts:

The private key needs to be 256 bit number, I don't see how to connect this with ANY password P to obtain the ScriptSig composed of private and public key. Also should't the hashed version of the public key correspond to eb271cbcc2340d0b0e6212903e29f22e578ff69b?

Similar doubt as in 1)

Funds can be stolen by the node that sees the transaction?

Your doubts regarding question 1 might well be a strong hint at the answer to question 3. :) Maybe this resource can help you answer the questions on your own: https://learnmeabitcoin.com/technical/script.

This is a "hashlock" contract, once the transaction that unlocks it is first broadcast, the miner can just take it for himself as there's no signature. https://en.bitcoin.it/wiki/Hashlock

This script is actually unspendable, because OP_SHA256 computes a 32-byte hash, but here it is compared to a 20-byte expected value, which will never match.


text:
can the buyers or sellers in smart contract be the miner also?
Can the buyers or sellers in the smart contracts be the miner also? Like someone be the player and also be the verifier?
Thanks for your help

Hi Simon, thanks for your question. It feels like you had more context in mind when asking the question, but it was lost in brevity. If RedGrittyBrick's answer didn't resolve your question, please provide more context to clarify what you were interested in.

Can the buyers or sellers in the smart contracts be the miner also?

Yes.

Like someone be the player and also be the verifier?

In Bitcoin, everyone verifies. All players are also verifiers. There are no players who are not verifiers. The miners do not have any special role in verification. Nobody depends on miners to verify anything.
The job performed by miners that is not performed by non-miners is a sequencing of transactions that results in the production of confirmations of those transactions. Confirmations are different from verification.


text:
Transaction blocks vs bitcoins
Sorry if this question is too basic or if it has somehow been answered before...
My understanding is that any type of Bitcoin block must be first mined, which applies to transaction confirmations, for instance.
However, if each and every block must be obtained from a mining effort, then for each and every block there is a reward (currently) of 6.25 bitcoins.
So for a given transaction, it requires a number of confirmations. If that transaction related to the transfer of 1 bitcoin from one person to another, it would require additional 6 confirmation blocks. Each of those confirmation blocks would have to be first mined. The miners would be granted 6.25 bitcoins for each of the transaction confirmation blocks.
In other words, there would be an exponential growth of bitcoins just for the sake of creating transaction blocks. And those bitcoins would in turn require more blocks so they could be traded/confirmed, which would result in yet more bitcoins granted to the miners.
Can someone please help clarify? Am I missing something rather obvious?
Thanks,
Julius

One new block is created every 10 minutes on average. The mining difficulty is adjusted to keep this rate constant
The mining reward is halved every 210,000 blocks, about every four years.
These two facts alone determine the amount of spendable Bitcoin available at any moment in time.
The result is that the total amount of spendable Bitcoin converges in a completely predictable way towards 21 million. It cannot exceed that.

(Source: Insti, Creative Commons Attribution 3.0)
As the mining reward approaches zero, miners will be rewarded through transaction fees alone.
Each block will typically act as the initial confirmation of several thousands of unrelated transactions directly and as a subsequent confirmation of each of the billions of transactions in the current Bitcoin chain since the beginning of time.

You stated: "Each block can confirm thousands of transactions." Can a block confirm totally unrelated transactions? Thanks.

Yes, normally all transactions in a block are unrelated.

@bordalix I'm not sure what you mean with "normally", but it is very much allowed (and not uncommon) for a transaction to spend another unconfirmed transaction, such as is e.g. the case with CPFP.

@stickies-v yes, you're right. With "normally" I meant most of the transactions in a block will be unrelated, which doesn't mean related transactions can't be in the same block.

You seem to be under the impression that each block has the purpose of confirming a single transaction or to increase the confirmations on one transaction.
Blocks are found approximately every 10 minutes and may write thousands of transactions into the blockchain. Subsequent blocks further increase the Proof-of-Work heaped on top of those transactions’ confirmations. So, while your transaction only needs to be included in the blockchain once along with many other transactions, the continuous growth of the blockchain increases the probabilistic immutability of your transaction.
You may also find my two answers on "Can someone explain how the Bitcoin Blockchain works?" useful, which provide comprehensive overviews of how transactions and blocks fit together from two different perspectives.


text:
How three addresses from the same (un)compressed key works?
As far as I understand, if we have one private key, we're able to create 4+ matching addresses. I'll use famous int(1) as a private key for example here. Then we can create:

P2PKH from the compressed key: 1BgGZ9tcN4rm9KBzDn7KprQz87SZ26SAMH
P2PKH from the UNcompressed key:  1EHNa6Q4Jz2uvNExL497mE43ikXhwF6kZm
Bech32 from the compressed key: bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4
P2SH: 3JvL6Ymt8MVWiCNHC7oWU6nLeHNJKLZGLN

When I check transactions of those addresses e.g. at https://www.blockchain.com/explorer/, looks like the transaction lists from all of them are different.
How can it be, if the private key is the same?
There's one guess I have, maybe stupid: when the owner obtains btc (either by mining or regular transaction), they arrive to one of those addresses. And despite the private key being the same, btc cannot be spent from other addresses. If it's correct, then we have three+ almost independent accounts that are managed by the same private key.
How it really works?

How it really works?

I think the easiest way forward is to cling firmly to the truth that addresses are a fiction. They are an occasionally convenient way to refer to a locking script. Too much focus on addresses will lead you away from the underlying truth.
If you think about locking scripts instead of addresses, I would expect things to become clearer.
From one pair of private-key and public-key, there are various ways of using the public key to construct different types of locking script that can be unlocked using the private key. There are several different standard locking scripts in which a public key is used.
An owner of a key-pair can separately track transactions that contain specific but distinct types of locking scripts involving the same underlying keys.
I believe blockchain explorers mostly index by abstract of locking script - so they produce separate lists of transactions for each unique locking script.

the transaction lists from all [the different address types] are different. How can it be, if the private key is the same?

The truth is that transactions don't pay to a specific private key, they pay to anyone who can unlock a locking script. Sometimes that unlocking might involve no private keys, sometimes that might involve several private keys.
Additionally, some types of locking script disclose a public key but some dont. So an explorer doesn't know if some types of transactio-output involve the same key pair. So the explorer can't reliably group transaction-outputs by common private key.


text:
Bitcoin keys explained?
I found a diagram, which explains in an excellent way how to convert a public key to a P2PKH address here(1). Also, I found a good map of types of addresses/keys here(2) and a list of all possible address prefixes here(3).
I'd like to understand how exactly private keys are converted into pub keys and addresses - like in (1) but for all elements (except testnet), starting from the private key.
Is there any documentation on that, ideally - as clear as (1)?
Thank you.

Do you want an explanation of all the elliptic curve cryptography that goes into the computation of a public key from a private key? There are tutorials out there, but I think it's a bit much for a stackexchange answer.

@PieterWuille no, explanation like function_name(...) is enough, just like doc(1) does not explain what ripemd160 or Base58 is.

@Putnik, function names will depend on what programming language you use and which library. I would only use libraries that have documentation for function calls.

@RedGrittyBrick ripemd160 or Base58  are not functions names only, it's the name of transformation, what should be done to get dataB from dataA. It's programming language agnostic, the same as in the doc (1). My apologies for not being clear.

@Putnik It's still unclear what you're asking for. Based on what you're saying, I think pubkey = secp256k1_pubkey(privkey) would be a correct answer, but I assume you want something more detailed than that.

@PieterWuille Thank you for your patience. I want doc which describes all way from random 256bit to public key in the form of this document: https://en.bitcoin.it/wiki/Technical_background_of_version_1_Bitcoin_addresses
In fact, the schema from that doc is the best element.

@Putnik There is nothing to be said, I've already given you the answer if that is your question. That document describes the process from public key to address using "cryptographic primitives" as the level of detail. The conversion from private key to public key is just a single cryptographic primitive "compute the secp256k1 public key for that private key". If you want more detail than that, we need to dig into the elliptic curve cryptography that is involved in that process.

Take a (random) integer from the permitted range, between 1 and the integer order of the elliptic curve base point G on secp256k1, i.e. between 1 and 115792089237316195423570985008687907852837564279074904382605163141518161494336 inclusive, and call it your private key dA.
Perform an elliptic curve point multiplication of the private key dA with the Generator G to calculate another point on the curve, the public key: QA = dA × G.
Use the public key QA with the coordinates (xQA, yQA) to generate an output script, then derive an address as described in (1) or (2).

Maybe that's the documentation that answers your question:

https://learnmeabitcoin.com/beginners/keys_addresses
https://github.com/bitcoinbook/bitcoinbook/blob/develop/ch04.asciidoc
https://learn.saylor.org/mod/book/view.php?id=36353&chapterid=18935

And there is a tool that may assist learning: https://bitcoiner.guide/seed/
Supplementary catalog:

https://www.lopp.net/bitcoin-information.html


text:
401 Unauthorized when try to connect to bitcoin-core using curl
The problem: I try to run a curl request but get 401 Unauthorized error.
curl --user testuser --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "getrawtransaction", "params": ["e0cee...47ac5", true]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ -D -

Enter host password for user 'testuser':
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Basic realm="jsonrpc"
Date: Sat, 02 Sep 2023 18:12:46 GMT
Content-Length: 0
Content-Type: text/html; charset=ISO-8859-1

The messages in the debug log of the daemon:
2023-09-02T15:59:44Z ThreadRPCServer incorrect password attempt from 127.0.0.1:36472

I run bitcoind this way:
/mnt/bitcoin/bin/bitcoind -conf=/mnt/bitcoin/bitcoin.conf

Also, I have a symlink for this config:
ll ~/.bitcoin/bitcoin.conf
lrwxrwxrwx 1 user user 25 Sep  1 18:42 /home/user/.bitcoin/bitcoin.conf -> /mnt/bitcoin/bitcoin.conf

Config:
grep -v "#" /mnt/bitcoin/bitcoin.conf | grep -v "^$"                                                                daemon=1
daemonwait=1
...
rest=1
rpcallowip=192.168.0.128/25
rpcallowip=127.0.0.1
rpcauth=testuser:3ad8c2e058a161304a911bcc60c208d2$a364136d41edda037d267e909f9f0355537aefee08b6fd29da2eee59559cf084
server=1
[main]
[test]
[signet]
[regtest]

rpcauth was created this way, and then inserted in the config:
python3 bitcoin/share/rpcauth/rpcauth.py testuser testpasst                                                                                String to be appended to bitcoin.conf:
rpcauth=testuser:3ad8c2e058a161304a911bcc60c208d2$a364136d41edda037d267e909f9f0355537aefee08b6fd29da2eee59559cf084
Your password:
testpasst

Also, I tried to replace rpcauth with
rpcuser=testuser
rpcpassword=testpasst

And did
kill -HUP `cat /mnt/btc_data/bitcoind.pid`

after every config change (idk wether it's needed or not)
Yes, I have "t" at the end of pass everywhere (I'm too frustrated to re-do all this solely to remove the typo, but the password was copy-pasted many times so I 100% sure there's no mis-type answering curl)
I tried: one two three four
What am I doing wrong?

I know how it sounds, but it works now, without any intervention from my side
The only idea I can think of is that the daemon reloads config not immediately but after some time (I did not try full restart after each config change)

It does not reload config at all; you need to restart to make new configuration active.

@PieterWuille is there any command to force config reload without restarting?

No, there is not.


text:
Where do i get parts for diy hardware wallet and program
I would like to know where to buy hardware for bitcoin wallet and program

Where do i get parts for diy hardware wallet and program

By DIY I guess you mean not a pre-built product like a Trezor.
Any electonics store or distributor (Mouser, Farnell, etc etc etc) will sell you parts to make any of the open-source options listed in https://en.bitcoin.it/wiki/Hardware_wallet
To pick a random easy example: pi-wallet - though a compute-module or zero-W would be more compact. There's plenty of open-source hand-held, battery-powered gaming devices based on that hardware that could be adapted to suit.
If you are more ambitious, and handy with a soldering iron, you could check out something like BitBox which is apparently based on standard electronics parts. They publish schematics and bill-of-materials for parts as well as the code. You'll not match their production quality but a functional portable device should be achievable with the right skills.


text:
Get scripthash for known scriptPubKey in python
I have to query addresses in ElectrumX server. How do I generate scripthash for a known scriptPubKey in python? If my bitcoin wallet address is 1P5ZEDWTKTFGxQjZphgWPQUpe554WKDfHQ ，I want to convert to scripthash


text:
Verify Bitcoin ownership
I saw a recent article supporting Craig Wright's claim to being Satoshi Nakamoto.  Other articles about him suggest that most of the community believes he's a scammer, and not actually Nakamoto.  The evidence he provided was some signature that apparently proved nothing.  On the other hand, Bitcoin developers challenged him to reveal the private key.  That seems pretty extreme, as it would allow anyone to spend all his BTC, no?
Wouldn't an appropriate demonstration be to announce that you are going to transfer a very precise but token number of BTC to some wallet, say, a charity?  This would preserve everyone's private information, but demonstrate that he has control of Nakamoto's BTC, no?  I assume anyone who is unwilling to make such a demonstration would automatically be assumed to be a fraudster.  What am I missing?

This is incorrect. The challenge was to sign a message with that key, not revealing the private key. That would be ridiculous.

@Prayank That answer seems unrelated. OP is asking whether proving ownership requires revealing a private key (it doesn't; one can sign if one has the private key). The answer you link is about a way of fraudulently convincing people of that without having the private key.


text:
Muun Wallet - All Funds Stored On-Chain?
I've read so far all official Muun articles about the submarine swaps and emergency kits, but one thing still has me confused.
Let's say I receive $500 worth of Bitcoin on-chain to my Muun wallet. These funds are stored on-chain and stay there for now as far as I understand. Now I make a payment via Lightning Network (LN) let's say worth $3. Now you do a submarine swap in the background as far as I understood.
But this is where I loose the plot. The party who sends the lightning payment need to get the BTC on-chain from my wallet or not? This would mean on-chain fees accure for every lightning payment?
Another question I have, if I receive e.g 100$ worth of Bitcoin via lightning to my Muun wallet, will I finally receive these on-chain aka is the whole balance that I see in a Muun wallet exclusively stored on-chain
Thanks a lot for your help!

At the time of writing this, Muun does indeed store all balance on-chain. It does not open any Lightning channels and instead uses submarine swaps for Lightning payments, which means it has to make an on-chain transaction (and pay on-chain fees) every time you send or receive. It also means your Lightning payments might have to wait for a block confirmation (10 minutes on average) if Muun decides your transaction has too much risk of being replaced while unconfirmed.
This makes Muun essentially an on-chain wallet with some Lightning capability, but without enjoying the two main selling points of Lightning, which are low fees and instant payments. According to Muun themselves, this design is a result of prioritizing user security.[1] However, they know that it's less than ideal and plan to transition to an "off-chain architecture that doesn't compromise user security".[2]

Is my understanding of atomic swaps correct that each time we make a Lightning payment with Muun, 2 onchain transactions are made in total (for which the Muun user would have to pay the fees)? One created by the user's Muun wallet to set up the submarine swap, and another one created by the Muun node to claim the funds, using the preimage from the LN payment they did for you and settling the swap? So that a Lightning payment with Muun would be more expensive than a normal onchain payment?

Correct. What I don't understand is how Muun doesn't charge fees with very low value transaction. I think they assume the cost and then charge more on higher transactions (of other users?). They should be more transparent about this.


text:
I want to transfer My fund To My old Mutlibit Core to Other Wallet
MY MULTIBIT CORE WALLET IS LOCKED I'M NOT ABLE TO ACCESS TRANSFER FUND IS THERE ANY WAY TO TRASFER MY ALL FUND TO OTHER WALLET PLEASE HELP ME BECAUSE I RECOVERED MY OLD ACCOUNT SO MUCH AFFERT BUT NOW I CAN'T TRANSFER MY FUND

What is MULTIBIT?

By "Multibit Core" do you mean https://www.multibitwallet.io/ or the old, long dead multibit legacy and multibit-HD wallets. If someone is asking you for money to unlock your wallet it means you have been scammed and you have no funds and there is no way to retrieve funds because they have been stolen or are fake.

Note: The multibitwallet.io domain was only registered yesterday and looks like some sort of scam to me.


text:
Is there a way to make a BTC wallet address public but hide how many BTC it contains?
So for example if you want to publicise a BTC wallet address so as to accept donations for a project, is there a way to hide the amount that has been received in donations so far?

Normally an address is an encoding of a specific output script, so all transactions using that address are linkable by that script. However, recently a standard has been developed called Silent Payments that uses addresses whose transactions aren't linked together because the address is used to derive a unique output script for each transaction.

Technically Bitcoin address does not contain any bitcoins, individual transaction outputs do. These outputs can be linked together if same address is used multiple times. Best is to avoid address reuse. Any decent wallet can generate billions of addresses. Silent payments is nice idea, but they aren't here yet, you should look at accepting donations by hosting some payment processor, for example, BTCPay Server or SatSale, that will show new address every time donation page is opened.


text:
but I haven't heard anything from chainabuse or ftc yet, and I was told that CiperBlade is not supported
Last year, I encountered a scam and the recovery company I met after that got my money back. However, in the end, the damages were not reported back. I recently happened to find the address that was in my watch wallet at the time. It looks like there is a lot of money, but is there a way to access it? I recently reported everything, but I haven't heard anything from chainabuse or ftc yet, and I was told that CiperBlade is not supported.

Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.

勘違いでした。現在はノーマルのウォレットに残高があります。しかし、送金が不可能です。何かのロックがあるようです。一度、確認して欲しいです。誰か紹介して欲しいです。

... in my watch wallet ...

There is no way to access money in a watch only wallet.
They are often created by scammers as a view of someone else's money which they use to deceive their victim.
All information on the blockchain is public, you can watch other people's money.
You could set up a watch only wallet to watch money in another wallet of your own, but you would remember having done that.
See

Reg: Watch only Address
How do I recover from a cryptocurrency scam?

勘違いでした。ノーマルのウォレットでした。壱度確認して欲しいです。

勘違いでいた。ノーマルなウォレットでした。壱度、確認して欲しいです


text:
make multiple addresses and send from one address to the other
I have a node, and I use GetNewAddress to generate a new receiving address. is it possible to transfer what's in that address to one of the other addresses I have created using GetNewAddress? Each address appears to have an "amount" property. so i assume each address has a balance. so i want to send what's in address A, over to Address B, but from the same wallet.  How would I go about doing this with RPC calls? Forgive me if I don't make sense I am still learning Bitcoin RPC. Thanks so much.

I would try Rawtransactions RPC calls such as createrawtransaction, fundrawtransaction and sendrawtransaction


text:
lost bitcoin card purchased from a drug store many years ago
We know the CVS location and can probably find the year and month. Without locating the physical card, is there any other way to recover the value? I know that LibertyX does transactions now, but do not know whether they were involved many years ago. thx


text:
Can an unconfirmed transaction be confirmed several years later?
Suppose that I make a transaction, but due to a low fee it is not confirmed even after several weeks. The transaction is then removed from the mempool of most nodes (and also my wallet disregards the transaction and allows to spend the coins again).
But since the transaction was signed and publicly broadcast to the network (all nodes), is it possible that anyone can rebroadcast the transaction and the transaction can eventually be confirmed even years later, if I do not spend the coins used in the transaction in the meantime?

Yes, that is possible. If the UTXOs still exist and the transaction is otherwise valid, then it could still be confirmed after all of that time.


text:
How to Bitcoin Core daemon start automatically each time your reboot your computer.?
In the official document of bitcoin.org, they ask to use an init script instead of cron job, see the init scripts directory in Bitcoin Core’s source tree.
But the link is not working
Bitcoin Core’s source tree
Cron Job option

@reboot bitcoind -daemon

I wanted to know the init script to restart a daemon

The init scripts can be found here: https://github.com/bitcoin/bitcoin/tree/master/contrib/init.

Can you please explain the working  of this command to start bitcoin daemon


text:
How to verify signature of multisig transaction
How to verify signature of multisig transaction (2-2) after it being signed by first owner? How can I understand if that owner used wrong private key => wrong signature?

There is no way to check the transaction separately for each signature. Either the entire transaction is valid or it is invalid. When you receive the partially signed transaction, you would need to sign it with your own private key using the signrawtransaction command in bitcoind. It would give you two outputs (1) hex which is the serialized transaction and (2) complete. If the second output shows you "complete": true, then the transaction you received was signed with a valid private key. If it shows false then it wasn't.

Technically, there is. In fact that is exactly what happens under the hood, each signature is verified individually and when all signatures verify, the whole transaction becomes valid. So when you receive a partially signed transaction, you could take the same steps to first verify whether the provided signature is correct or not then sign it with your own key.


text:
P2SH to LTC address with M
Are there anyone know how to convert P2SH address (like 34A5PyCvPJKYtHmj9jmKhGzBBwpGuAkZog) to MANDhrctLRAygo3dFckfWvEaWeQizSwWNK?
I tried to decode with Base58Check, then removed 05 and added  032, then encode it (Base58Check), however I got wrong result MANDhrctLRAygo3dFckfWvEaWeQiti143C

The reason you are getting a different address is because you are appending the same checksum that you got from using the 03 prefix to the new prefix + payload. You need to double hash the new prefix + payload and then append the first four bytes and then encode it in base58.
If I decode your result MANDhrctLRAygo3dFckfWvEaWeQiti143C to hexadecimal, I get 321b0e61ac671bde7fb52e2f3d6e2dc213609d9de5020cb31b. In this hexadecimal string, your prefix is 32, payload is 1b0e61ac671bde7fb52e2f3d6e2dc213609d9de5, and checksum is 020cb31b.
The checksum that you would get after double hashing the new prefix + payload is e29f4248. So, you should base58 encode 321b0e61ac671bde7fb52e2f3d6e2dc213609d9de5e29f4248


text:
A couple questions on lightning network
I want to develop Exchange where people would use my service to make payments using lightning network
I configured the LND node and created a wallet.
To implement this I would like to allow users to create addresses, and then to send money from one address to another (under same wallet)
Moreover, If they wanted to withdraw money to random simple-bitcoin address (like 1BzVLSNcwznjoynyuFgMXwaGeevycLgDEN)
Therefore the very general question is: Is it possible?
The  questions are:

Assume I created address#1 and address#2 under same wallet. How to transfer funds? Should I open a channel to do that?
Is it possible to send funds from address in lightning network to simple bitcoin address?
Are there any ways to choose sender address (in case users created thousands different addresses and user wants to send satoshis on behalf of himself)

generally it makes more sense on this site to ask separate questions ins separate threats and have the question itself as the title and the text as elaboration.

Assume I created address#1 and address#2 under same wallet. How to transfer funds? Should I open a channel to do that?

You seem to confuse bitcoin addresses and lightning network ids. If you have a lightning node you have a node pubkey (called the node_id). Of course there is a corresponding private key / secret. From this you can derive bitcoin addresses in your bitcoin wallet that is attached to the lightning node. Those addresses are used to fund your node or to claim funds from channels that for some reason hit the chain.

Is it possible to send funds from address in lightning network to simple bitcoin address?

As from the first part of the answer. once the channels hit the chain they are in the bitcon network and can be send to any other bitcoin address. There are exchange-services that allow and atomic on/off-chain swap. means you pay in invoice on lightning so that onchain bitcoin arrive at some address and vice versa.

Are there any ways to choose sender address (in case users created thousands different addresses and user wants to send satoshis on behalf of himself)

If I understand your question correctly I would say it is possible. In the current setting people who offer a custodial wallet service seem to sign all invoices with the node ID of the lightningnode that is powering the custodial wallet. There speaks nothing against giving every user their own secrete and their own node id / bitcoin keys. You could even have virtual payment channels between the exchanges lightning network node that you maintain an run and between the "virtual" nodes of your customers which are basically private and suggest in the routing hints of the invoice to use the lightning node of your service.
In order to do these kinds of tricks you might want to switch to c-lightning as with their plugin infrastructure have an API that allow easier customization for such features.

I still dont get it:  if I want to users allow to make payments (each with their own bitcoin address) to each other, I need many LND instances running? Because if there are only lightning nodes, connected by payment channel (= 2 users in blockchain "connected" by having a 2-of-2 multisig address), then I need as many nodes as many users(=unique addresses) I have?

When using lightning the users don't have to have a Bitcoin address lightning nodes have a different address space / scheme. You can do all of this on top of one lightning network node but then it is custodial. The power of lightning is that every user should run their own node anyway but I guess this goes against the service you might want to offer

Big thanks, your answer helped me a lot! Can you clarify a bit what you meant when said "do this on top of one lightning node"?

Bitcoin has addresses but there is no such thing as a Lightning "address" where you send the Lightning funds. A Lightning channel is opened by sending funds to a 2-of-2 multisignature Bitcoin address. From that point onwards invoices are sent back and forth using the Lightning protocol with balances updated as users agree to pay the invoices.
To receive your Bitcoin onchain and effectively leave the Lightning Network you close the channel and send Bitcoin from the 2-of-2 multisignature Bitcoin address to a Bitcoin address that is solely controlled by you.
You can run multiple Lightning nodes and send funds from any of those nodes that can afford to transfer the funds. When the receiver requests a Lightning payment they send an invoice that can be paid by any Lightning node. There is no restriction on where those funds should come from.

question #3. So that, the only way to transfer funds between addresses is to have many nodes (and each node will have own wallet)?  I probably don't understand it  good enough, but for now, it seems like waste of resources just to pay to someone once

There are no Lightning addresses. Lightning nodes transfer funds to other Lightning nodes. There is also no global record of all Lightning transactions so there is no concern of "address reuse" or the same concerns on privacy leaks. If you want to do multiple Lightning payments you can do them from the same Lightning node without needing to spin up a new Lightning node each time.


text:
Ripple difference between source and destination tags
I don't understand the real difference between source and destination tags.
Imagine we have client A and service B, and service B wants to identify the payment (deposit from A). He says: please send funds to address (0x123 and use destination tag "12345") why he should ask A to use destination tag but not source tag?
Why A can't use source tag '12345', can't B still identify A payment from source tag?

The ledger itself doesn't really care what tags you attach to a payment. They're just used to help exchanges or wallet services know who to credit for a payment.
The standard use of the a destination tag is to identify the recipient of a payment. The idea is that whoever or whatever controls the account that received the payment will look at the destination tag and know how to properly credit the payment.
While the source tag is rarely used, it serves a complementary purpose. Say Jeff has an account at exchange A and wants to send XRP to exchange B. He fills in exchange B's account and a destination tag that exchange B knows means to credit Jeff and asks exchange a to make the payment.
Now, suppose for some reason exchange B can't credit Jeff. Maybe his account his closed. Maybe he got the destination tag wrong. If exchange B doesn't know who to contact, they might try to return the payment. But if they just send it back to exchange A's account, how will they know to credit Jeff?
This is where the source tag comes in. If exchange A uses a source tag that it associated with Jeff's account in the payment, then exchange B can use that as the destination tag if it needs to refund, return, or partially refund the payment. It can use the incoming source tag as an outgoing destination tag and Jeff will get his XRP back.


text:
How does bitcoin core establish a peer to peer network
I've tried to look for an answer to this online and haven't found any. My question is: how does bitcoin establish a peer to peer network. Establishing a centralized network with a server in the middle between all clients is trivial. However, establishing a fully peer to peer network isn't that easy. This is mostly due to NATs and Firewalls. How does bitcoin core get around NATs and Firewalls. Does it use holepunching, and, if so, is there a central server that dynamically updates public and private Ip/ports? I guess I would just like to know how the peer to peer network is established.

Does this answer your question? How do Bitcoin clients find each other? and What is the NAT traversal technique used by bitcoin?

Not really. None of the two explain how bitcoin deals with NATs and firewalls. Or what set of protocols from the OSI model does it use to communicate with other peers. Does it use http? Websockets? Does it use it's own application layer protocol?

The Bitcoin P2P protocol is an application-specific layer over TCP/IP.
If a node does not have an open port by themselves, they can only make outgoing connections. Node software uses things like UPnP to request NATs to open ports, but if that fails, a node's connections will be unidirectional.

If a node's connection becomes unidirectional, then it can only make requests to other nodes with public IPs and Ports. Is that how unidirectionally connected nodes update their blockchain?

Could you briefly elaborate on what UPnP is please.

Yes, but the protocol is symmetric. So if a node can only make outbound connections, that is still a fully-featured connection between two nodes - it doesn't matter who established the connection. There isn't a "server" and "client" side to the connection.

But it does, ultimately, resemble a client server architecture in the sense that nodes that are behind NATs, just like clients in a client server architecture, can only make outgoing transactions but cannot listen to incoming transactions. It's similar to a REST API.

Yes, in terms of connectivity you are right, but not in terms of functionality. If A connects B, then it will be both the case that A requests things from B, and B requests things from A.

based on my knowledge, bitcoin core connections aren't technically symmetric and there are comments in code that prove this, like on GETADDR message that gets ignored if the sender is a peer different than inbound. So basically a peer that can only have outbound connection will never send other peers its known addresses (this is an example but I think there are other cases where there aren't asymmetric behaviors)

Sure, and transaction relay also works slightly differently in both directions. Still, both parties will learn each other's transactions and blocks.

let me go a bit OT @PieterWuille to show gratitude for the effort you put in cryptospace and your attitude you keep showing to help people since long time


text:
Is there a CUDA binary to convert a brainwallet string to a BTC address?
I am looking for a CUDA program which will take a single argument, a brainwallet password, and output a BTC address.  After reading through several threads on how to convert passwords to public keys, and public keys to addresses, I figured there must already be something that does this.
Any suggestions welcome.  Thanks.

Brain wallets are now understood to be a very insecure way to store BTC.
The software which was the sort of final 'nail in the coffin' for the (lack of ) security of brainwallets can be found here: Brain Flayer.
Its not CUDA software, but may be relevant to you anyways.


text:
What does this variable R mean
What does this variable R mean if it is the same in transaction signatures, and can I find S Z from the transaction I want an explanation or someone helps me to find the variables
type address:  3AQYerxq4C2qmjthFpKCHYuoM8mzMRE9Q7
ADDRESS-R-SCAN:
Data for pubkey: 3AQYerxq4C2qmjthFpKCHYuoM8mzMRE9Q7 has   50  Txs
Fetching Txs from offset        0
Fetching Txs from offset        50
Resued R-Value:
87c735eb8413a42fc856eec1ff432ef43c25
Resued R-Value:
87c735eb8413a42fc856eec1ff432ef43c25
Resued R-Value:
87c735eb8413a42fc856eec1ff432ef43c25
Resued R-Value:
87c735eb8413a42fc856eec1ff432ef43c25
Resued R-Value:
87c735eb8413a42fc856eec1ff432ef43c25
Resued R-Value:
87c735eb8413a42fc856eec1ff432ef43c25
Resued R-Value:
87c735eb8413a42fc856eec1ff432ef43c25
Resued R-Value:
87c735eb8413a42fc856eec1ff432ef43c25
Resued R-Value:
87c735eb8413a42fc856eec1ff432ef43c25
Resued R-Value:
87c735eb8413a42fc856eec1ff432ef43c25
Resued R-Value:
87c735eb8413a42fc856eec1ff432ef43c25
Resued R-Value:
87c735eb8413a42fc856eec1ff432ef43c25
Resued R-Value:
87c735eb8413a42fc856eec1ff432ef43c25
Resued R-Value:
Resued R-Value:
Address 3AQYerxq4C2qmjthFpKCHYuoM8mzMRE9Q7 has 15 reused R values!

Are you asking us "how to extract the private key of the address containing $18000 worth of bitcoins"?

I don't want the private key, I just want to know what this variable is and how I can extract other variables

ECDSA signing uses a random number called the nonce. A signature contains two numbers (r, S). r is generated only from the nonce and the nonce mustn't be reused. When the nonce is reused, r is the same too.
https://www.maximintegrated.com/en/design/technical-documents/tutorials/5/5767.html Eq 2 shows how r only depends on the S.
I don't know what you're referring to as Z.

Because I am currently collapsed and I want a solution. I lost my wallet in 2014 and I could not reach it. There are approximately 9 Bitcoins in it. I am looking for it and I could not reach it. I thought about committing suicide.

What is the solution? Please, your watch, my wallet, and you extract the variables so that I can access the private key

Which wallet software was it? File recovery tools might be useful.

The problem is that my device is being destroyed because of the bombing, because I live in Yemen and there is war

The war completely destroyed my house, and my transformer was inside it

Is the address that has reused R values your address? The address didn't exist in 2014, but if your address has reused R values it should be possible to recover.

No, you did not understand me, I did not lose it in 2014, I mean the war started in 2014, but I lost the wallet last year and my house was bombed at the end of last year in about 9 months. I ask you to excuse me because I do the translation through Google and the translation is not accurate because I do not understand English well

this is my address 1XCPdWb6kk7PGfvbdRbRuNh51aPc4vqC7

I have scanned the first 10 thousand transactions. I couldn't find any duplicate r values. Unfortunately it seems that it's not possible to recover the coins but I'll report to you once again once I have scanned all transactions

Thank you very much for your understanding of the difficult situation that he and I and colleagues passed through because of the war. There are many people who lost their money saved in Bitcoin in particular in Yemen, and this is bad luck

@hishamyem I have scanned all the transactions. Recovering doesn't seem to be possible. Sorry for your loss.


text:
What is the formula for calculating the private key? resued R value
What is the formula for calculating the private key? I want the equation in detail to try to solve it on cocalc
I want an equation to extract the private key from two different addresses I have tried
K ((z1 * s2 - z2 * s1) / (r * (s1-s2)))
And it didn't work
These are the data for the transactions
tx/ 952730ab31f6e9949343bc186484f95168fa6842489e89b5b48500c54818c683
01000000013cc593a1e73b9c7b5aa30e2ae1ae5ab31301b7a789ce43575c9f859513f85a800100000068453042021e6fcf15e8d272d1a995af6fcc9d6c0c2f4c0b6b0525142e8af866dd8dad4b02207b4bde105608e96da63b54288a5dae961fc074008f4fc9c79d4e486fb9d4bc0b012102a0d204d69210b21d79c60b506b27259c314f0c64ea24d419696722ea285db1f1ffffffff0103621700000000001976a91428dc4730af1538b45ee1f0e3df7a9c9f31b000a388ac00000000
"sigR": "6fcf15e8d272d1a995af6fcc9d6c0c2f4c0b6b0525142e8af866dd8dad4b",
"sigS": "7b4bde105608e96da63b54288a5dae961fc074008f4fc9c79d4e486fb9d4bc0b",
"sigZ": "c49cc0d0ef2a72386e63d28a319e58dc0258dacedf9f7858619a615bb20cd8f6",
"pubKey": "02a0d204d69210b21d79c60b506b27259c314f0c64ea24d419696722ea285db1f1",
tx/ cf7a5114e0036d98c531538885b4c906a47d74a615721d620b3c53d4f7c43856
0100000001ed11d775420022c79e7d17ae587242dcc3a1a679f64b27451712b990bdc84a720400000088453042021e6fcf15e8d272d1a995af6fcc9d6c0c2f4c0b6b0525142e8af866dd8dad4b022078f05c60ebd2befb89a62e438c17ace056d6a450de5c6b1a3eff8fb5080928c501410482ba73f4c09accb62b982ab2b29848a292e3380e062c03c03a5880a918f937ea28f2b7da09deb91c2358414ffd31f8daacc60a5e2f9cafb8b9d212f8a888c7e8ffffffff0129060000000000001976a91428dc4730af1538b45ee1f0e3df7a9c9f31b000a388ac00000000
"sigR": "6fcf15e8d272d1a995af6fcc9d6c0c2f4c0b6b0525142e8af866dd8dad4b",
"sigS": "78f05c60ebd2befb89a62e438c17ace056d6a450de5c6b1a3eff8fb5080928c5",
"sigZ": "3d9f9cf2b32fac5966773e0f1697f1601218c72c1a908cf11278b30da2b6a0ed",
"pubKey": "0482ba73f4c09accb62b982ab2b29848a292e3380e062c03c03a5880a918f937ea28f2b7da09deb91c2358414ffd31f8daacc60a5e2f9cafb8b9d212f8a888c7e8",
"N": 0
}

If the same private key is used to sign different data with the same R (or equivalently k), the private key can be extracted. Since the transactions you linked have inputs from different addresses, there's no one private key that you can extract.
However, if you know the k value that caused this R value, which you would if you're the creator of at least one of these transactions, you should be able to extract the private key of the other by using the same method but skipping the derivation of k steps.

I don't understand yet, can you write the equation to include it in the https://cocalc.com program

@hishamyem: Reusing the same "r" value is only unsafe if you reuse the same private key. For different private keys, you cannot learn anything unless you knew "r" in the first place.


text:
Is there still a digital signature loophole in Bitcoin transactions?
I want to ask a question: Does the problem of repeating the value r still persist today in Bitcoin transactions? If so, how can I find transactions that contain this thing? I have research on how to protect digital assets.

Does the problem of repeating the value r still persist today in Bitcoin transactions?

If your question is whether Bitcoin signatures are still vulnerable if their nonces are generated in a bad way: yes, absolutely. The security of the ECDSA scheme (and the Schnorr scheme introduced in BIP340) relies on signatures being created using nonces that are entirely unpredictable to attackers.
However, I do think it's fair to say that the software stacks used in Bitcoin software that constructs these signatures has matured so it occurs less in practice. Techniques like deterministic nonces as standardized in RFC6979 makes it much easier to write safe implementations.

If so, how can I find transactions that contain this thing?

There are questions on this site that give more practical details, but in broad lines, you go over all the blockchain's transactions, group signatures by the public key they're created for, and within each group see if any R value is repeated. If so, you can generally compute the private key from the signatures.
Rest assured that any funds remaining in addresses whose keys can be retrieved this way are instantly stolen.

I have research on how to protect digital assets.

Use production-quality, well-reviewed, wallet software or libraries. They will produce signatures in secure way. If you're writing code yourself where bad nonces are a concern, you're almost certainly doing something wrong.


text:
Do bitcoin miners calculate the hash value of current block or next block?
I'm new in bitcoin and my question seems be stupid. I appreciate your help.
Miners calculates blockhash as picking a proper nonce.
And he is awarded.
To calculate block hash, he will need 6 values. 2 of them are merklehash and nonce.
I'm gonna say about merklehash and blockhash. Suppose that miner A is trying to calculate.
To calculate blockhash, merklehash is needed. But merklehash is a hash of all transactions of the block. The first transaction data is that a miner is awarded(?). That means merklehash is calculated after awarded miner is determined. What's the difference between awarded miner of this block transactions and A? I really don't understand.

@Murch that's not what I asked.

It seemed to me that you were asking about the order in which the coinbase transaction and the nonce are found. The coinbase tx is picked first, then the miner tries nonces to make their block template a valid block. This is described in the linked question. If you are asking something else,  please edit your question to clarify. I'll reopen the question.

If I'm a miner, I only want to mine a block that awards me. So I'll create a block that awards me the reward and see if I can find a nonce that makes the block valid. If so, then I am successful.

After reading your question, you are a little confused, so i will try to explain:
Miners do double round of SHA256
What they hash?
They hash the blockheader...
What's the blockheader?
The blockheader is build from data
What data?
It's Build from:
Version: The version of the block.
Previous block hash: The Block Hash of the block that this block is being built on top of. This is what “chains” the blocks together.
Merkle root: All of the transactions in this block, hashed together. Basically provides a single-line summary of all the transactions in this block.
Time: When a miner is trying to mine this block, the Unix time at which this block header is being hashed is noted within the block header itself.
Bits: A shortened version of the Target.
Nonce: The field that miners change in order to try and get a hash of the block header (a Block Hash) that is below the Target.
All this is in little endian


text:
Bitcoin core: How to get transactions data having block?
There's a verbose output of the very first block info:
bitcoin-cli getblock 000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f 2

{
  "hash": "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f",
  "confirmations": 790168,
  "height": 0,
  "version": 1,
  "versionHex": "00000001",
  "merkleroot": "4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b",
  "time": 1231006505,
  "mediantime": 1231006505,
  "nonce": 2083236893,
  "bits": "1d00ffff",
  "difficulty": 1,
  "chainwork": "0000000000000000000000000000000000000000000000000000000100010001",
  "nTx": 1,
  "nextblockhash": "00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048",
  "strippedsize": 285,
  "size": 285,
  "weight": 1140,
  "tx": [
    {
      "txid": "4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b",
      "hash": "4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b",
      "version": 1,
      "size": 204,
      "vsize": 204,
      "weight": 816,
      "locktime": 0,
      "vin": [
        {
          "coinbase": "04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73",
          "sequence": 4294967295
        }
      ],
      "vout": [
        {
          "value": 50.00000000,
          "n": 0,
          "scriptPubKey": {
            "asm": "04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f OP_CHECKSIG",
            "desc": "pk(04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f)#vlz6ztea",
            "hex": "4104678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5fac",
            "type": "pubkey"
          }
        }
      ],
      "hex": "01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff4d04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73ffffffff0100f2052a01000000434104678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5fac00000000"
    }
  ]
}

As far as I understood, we see here one transaction (in "tx": [...]), on 50 BTC, the transaction id (txid). Having this data, how can I get the input/output address using e.g. the same bitcoin-cli or RPC API equivalent (according to the doc)?
Does coinbase in vin means Block Reward?
How from vout (or wherever else) get the address we usually see (1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa)?
I tried bitcoin-cli getrawtransaction ... (as here) but the output is unclear to me.
If bitcoin-cli is unable to provide that - then any other way?

how can I get the input/output address using e.g. the same bitcoin-cli

The general answer is:
To get addresses relating to inputs you need to fetch the locking scripts (scriptPubkey) from the referenced outputs of the referenced transactions.
To retrieve transactions by ID, I believe you have to have transaction indexing turned on in bitcoin.conf. It will take a while to construct an index of transaction-IDs. I expect you need pruning turned off. In the worst case you have to repeat the Initial Block Download process.
For two separate reasons, your example's input does not refer to an actual previous transaction

It is a coinbase transaction, their input is not a real input.
Your block is the first, there are no earlier blocks.

So there is no source address.

Does coinbase in vin means Block Reward?

In this case it refers to the arbitrary data that a coinbase transaction has in place of the unlocking script. This is the first transaction in a block and is therefore a coinbase transaction.
BIP-34 specifies that the first item in this arbitrary data is a push of the block-height. Older blocks don't have that but all recent ones do. The remainder is whatever the miner wanted to record.
The amount of available block reward is only indirectly determined. It depends only on block height. It is affected by the halving interval, which is fixed.
The miner doesn't have to collect all or any of the available block reward. The amount they choose to claim is in part of the vout value. For understandable reasons, miners usually claim the full amount available but sometimes people don't - probably mostly as a result of a mistake.

How from vout (or wherever else) get the address

You (or Bitcoin core) have to calculate it from the relevant locking script.

How to get "From" and "To" addresses from bitcoin transaction using the command line?
How can I get the destination address from raw transaction data?
How to get input address and amount from vin using bitcoin core rpc
Deriving the Bitcoin address from the raw block script

Addresses have well-specified or de-facto address derivations for only some types of transaction output, not all.
In some cases there is no address, or no universally agreed address, or no meaningful address.


text:
is consensus needed when double spend attacks cannot happen(assume ideal case)
Suppose double spend attacks cannot happen(assume senders, miners etc are all ideal actors) in a network like BTC for cryptocurrency transactions. I am assuming still fork can happen if two miners produce blocks say b1 and b2 almost same time linked to same previous block. Will then be there any need to do consensus?. Can there be still conflicting transactions?

Even with no malicious intent, block chain forks can occur. In this case you still need the "most work chain" rule for the network to converge.

I am trying to see what if no double spend. Then each node might have different order of blocks but they are all good transactions. So in that case is there a still need to make /converge it a single chain for all using the chain rule? if so tell me a case where it is needed.

No one is "designated" to mine the next block. There is not a single valid next block. Multiples miners around the world are mining different valid block candidates. As such it's possible (and actually common) that two miners would find a valid block before any of the two has propagated throughout the whole network. One part of the network would be on chain with block A and another one with block B. It's necessary for the network to come on a conclusion about which block will be accepted moving forward. This is achieved by using the most work chain rule.

If you have a rule that miners coordinate with one another to make sure no concurrent blocks are produced, then that is your consensus mechanism. You haven't removed it, just replaced it with another one.

I am assuming for some reason double spend wont happen(it is given). Suppose the DAG is not resolved using chain rule. so fork is happening and all nodes keep this but they are validated transactions and it is given double spend wont happen. Can there be conflict or issue because of this ? Or I am going wrong somewhere ?

So you're talking about a system that wouldn't have blocks? I'm struggling a bit to follow here.

Yes hypothetical, with or without blocks.


text:
Is there anyway I can recover my passphrase?
I have a wallet for the bitcoin qt wallet but I accidentally deleted the only copy of my encryption passphrase... I have read about something called brute force but I'm not entirely sure on how its code is used. Can anyone help me please!? I am desperate to recover my bc!

It's rather implausible unless you remember a good deal of the password already, or you are certain that it followed a particular pattern. Even on a good processor you might only be able to try 10 variations a second, which is uselessly slow for anything in the password cracking world.
It needs to be strong, the encryption is designed keep your coins safe.
How much is at stake? Recovering them might not even be worth the time expenditure.

Using brute force you won't be able to recover your passphrase within your lifetime, but you can use vanitygen to recover it (well it won't be you who recover it, it will be your grand grand grand .... sons who will finally recover it)

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
bitcoinj, unknown confidence level
I've got a bitcoin address A with its relative encrypted key K stored in a persistence storage.
I am launching bitcoinj through the WalletAppKit class and calling awaitRunning to wait for the blockchain header being downloaded.
I am adding the key pair (A,K) to the wallet after decrypting the key.
I am using the hex of an unspent transaction from the address A and using it as an input for a new transaction with an address B as output.
I am trying to propagate the newly created transaction to the network but i get "Unknown confidence level" message also if the input transaction has many confirmations.
I think the spv blockchain has to be synced after adding address A but i don't understand how to do it.

Interesting. Have you tried to contact the author of bitcoinj? https://github.com/schildbach

I asked Mike Hearn and followed his advise to post on the project mailing list https://groups.google.com/forum/#!topic/bitcoinj/-Bj3lvM8yFQ

I changed approach, i am using bitcoinj to create and sign the transaction but not for sending to the network. Thanks to http://bitcoin.stackexchange.com/questions/8475/how-to-get-hex-string-from-transaction-in-bitcoinj i am getting the raw hex format of the transaction and sending it to the network through external services like blockcypher or blockchain

Be careful to use these kind of API, they have small limits. I recommend you to use the default client.

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
exploring a local copy of the namecoin blockchain?
I installed electrum-nmc as a namecoin software and download blockchain in my computer. where I can find local copy of namecoin blockchain?


text:
Transfer amount on blockchain larger than was sent from wallet
I sent some BTC from a hardware wallet last year.
The wallet shows a sent amount of 0.09302 BTC but when I look at the transaction id on blockchain.com it shows two amounts.
0.282 BTC unspent and 0.0924 BTC spent
Where has the 0.282 BTC come from was someone elses transaction somehow included with mine?
ea0be0433c3a0869aa62ff025abd33d5a400f51835f05c87f844d0e8158be0aa


text:
Changed address
My address has changed but I'm showing 0.00mbtc.  when I lookup the information on Blockchain it confirms 0.00 but then States the address has yet to be used on the network. I'm confused, please help.

Changed Address
My address has changed

OK, your problem is that your address has changed.
"My address"
"My address" implies to me that you probably only have one address, otherwise you would probably have written "one of my addresses".
It also implies that the address is associated with a person not with a wallet or private-key etc. I expect that is probably just a loose way of using words but that phrasing might be a result of a misunderstanding - I can't tell how much experience you have. Don't take offence, I am trying to help but it may be I am pitching my help at the wrong level. You are new here, I can't tell how clued-up you are.
"Changed"
"Changed" means to me that an old address has disappeared and a different address has appeared in its place. This seems to me to be a possible misunderstanding of the way in which addresses are used in wallets.

What your question title means on the surface is that your wallet looked like this
On Monday:
,-----------.
|Address|BTC|
|-------|---|
|123... |500|
|       |   |
|       |   |
`-----------'

On Tuesday:
,-----------.
|Address|BTC|
|-------|---|
|987... |  0|
|       |   |
|       |   |
`-----------'

and you are puzzled why your address changed from 123... to 987...

Addresses in wallets don't really change, you can generate new addresses but the old address still exists. Typically you generate a new receiving address for each payment you want to receive.
Your wallet probably has a way of organising these addresses so that you can see the total unspent amount associated with just one address or one group of addresses.

when I lookup the information on Blockchain it confirms 0.00

Then it is probably true.
Sometimes transactions take a long time (potentially a very long time, or forever) if the fee is too low.

I didn't receive any payment

The sender could have made an error in entering the recipient address.

I've got 13 addresses in my wallet but no bitcoins.

That might be normal if you have received BTC in 13 transactions and then spent them all.

Remember, the clearer the question, the better the answers. If this answer is useless to you, try editing your original question and explaining it like you would explain it to your grandmother, take time to plan out how you could organise the question to make it clear to her. Don't forget to sketch out the background to build an understanding of the situation. Don't omit details that may be crucial to an answer.
Just my BTC 0.00 worth.

Can you explain what you mean? Because I didn't receive any payment?... I've got 13 addresses in my wallet but no bitcoins

@JT: I edited my answer to clarify. It now seems likely I misunderstood what you were saying. If so I'll delete this answer as it is unlikely to be helpful to you and anyone else other than to illustrate the need to take care when writing an answer to clearly explain what has happened and what you need help with. Screenshots and actual addresses would probably help people to help you.

No I'm a newbie and I'm just seriously confused.  You are actually helping me thank you.  I have another question regarding this.  I actually never sent any transaction at all but my addresses are changing?  I'm using bitcoin for developers wallet on my phone.

Are you using this?

Yes I'm using the wallet previously mentioned


text:
Litecoin address starting with ltc
my litecoin wallet (shared 2 of 2) on electrum-ltc generated an address to receive LTC. I transfered some LTC to that address and tried to check in block explorer. Unfortunately got such message:
Sorry, 'ltc1qy4rwhdkujk35ga26774gqmng67kgggtqnsx9vp0xgzp3wz3yjkhqashszw' is not a valid LTC address, wallet name, transaction or block.
Is it something wrong with my LTC address? Electrum-ltc v 3.1.3.1. From what I know it is Bech32 Segwit address.

Your address is in the native-segwit format (also known as bech32).
It's an entirely new address encoding scheme for segwit addresses, and many exchanges, explorers, and wallets don't currently support it.
If you are unable to send coins to it due to the sender not supporting these addresses, you will need to set up a new Electrum wallet, and during the setup process, use P2SH-P2PKH addresses, which will start with M.
If the sender still does not accept the address, you can convert it to one starting with 3 using https://litecoin-project.github.io/p2sh-convert/.
https://insight.litecore.io will accept addresses starting with M for balance checks, and show outputs to the ltc1 addresses, but it will not have an address page for the latter.

Thank you for your answer. I don't know if there will be a problem with withdrawal. My withdrawal still has 'confirming' status. We'll see. Thanks!

@user2923339 If the withdrawal goes through, I wouldn't worry too much about the explorer bit. ltc1 addresses are the future, and the cheapest to send transactions from. You should definitely use them if you can, but may need to fallback to the M/3 addresses if the exchanges/services you use don't support them yet


text:
Tracing bitcoin wallet with the address
I once created a bitcoin account and obtained an address. When i needed to transfer some bitcoin, i didn't check the address hoping it was active. After the transfer, I tried opening it but it did not. I thereafter created another account. What happens to my transfer?
Secondly, how do I use the address to locate the bitcoin wallet so my money wont be lost?
Thanks.

There's no concept of an "active" address or a Bitcoin account. If you have an account with a company, they control your bitcoin address (they hold the private keys), and you'd have to contact them.

I once created a bitcoin account

This implies you created an account with an online business through a website. Perhaps they managed your money for you in their wallet. This is arguably the most insecure way for you to hold Bitcoin.

and obtained an address

You don't mention a private-key. If you don't have sole control of your private-key from its creation until now, then you don't really own any bitcoin yourself.

What happens to my transfer?

If you have an account (or two) with some online business, you have to contact them to find out what happened to any money you gave them.
If so, this isn't really a question about Bitcoin itself - which was designed to work without the need for any online business to hold your Bitcoins for you.
Bitcoin transactions cannot be reversed or cancelled. The Bitcoins are owned by anyone who knows the private-key for the address you sent Bitcoins to.

how do I use the address to locate the bitcoin wallet so my money wont be lost?

You can't use an address to find a wallet.
You can look inside wallets to see which addresses they contain. If a wallet contains an address that matches the address you originally obtained - then you have found one of possibly several wallets that can spend the Bitcoins associated with that address.
20-30% of all Bitcoins are lost forever and can never be spent by anyone at all.


text:
What happens to off chain transactions when the blockchain is reorganised?
Many companies seem to use off chain transactions to transfer bitcoins between their own customers. What happens when a side chain gains dominance and no longer contains a block with the underlying transaction?
Let me explain my question with an example:

Customers A and B have Coinbase wallets.
Customer A receives 10 bitcoins from Block 1 into his wallet.
He instantly transfers 5 bitcoins to B's wallet using an off chain transaction.
B spends 1 bitcoin using and on chain transaction and that is included in Block 2.

This is displayed again below:
Block 1 -> A -> Off Chain -> B -> Block 2
10 BTC          5 BTC             1 BTC

Now suppose Block 1 and 2 now become invalidated due to a reorg of the blockchain and the initial 10 BTC transaction in Block 1 never makes it into a block again. However, the 1 BTC transaction from Block 2 does make it back into another block.
This could potentially corrupt an off chain system like Coinbase because it would end up not having the initial 10 BTC from Block 1 but customer A has still managed to give 5 BTC to customer B who has managed to send 1 BTC back to the blockchain.
In this example the off chain wallet company eg Coinbase, BitPay, Circle etc will potentially lose 10 BTC because it has already been allocated within their systems.
How do these companies resolve this issue and unravel their systems?
Do they detect that Block 1 no longer exists and then reverse the transaction to A and B's wallet? Or do they use other means? Maybe they just take the hit and lose the 10 BTC from their profits?

You answered your own question.  Rephrasing as a statement:

[Some companies] detect that Block 1 no longer exists and then reverse the transaction to A and B's wallet.  [Other companies] take the hit and lose the 10 BTC from their profits.

Which solution to implement is a choice that's up to the company---neither solution is inherently better or worse.  (Reversing the transaction is better for short-term profits, but taking the hit (if you can prevent most fraud) may make your customers happy and increase long-term profits.)
Bitcoin payments are push-based: Alice pays Bob.  An alternative solution to this problem is requiring depositors to provide a backup payment method that is pull-based. In the event of a double-spend, this will allow Bob to charge Alice's debit card.  Although expensive, time-consuming, and not guaranteed to work, the ultimate pull-based payment method is going to court and suing the double-spender.

Are there any other options that should be considered other than the two I mentioned? (Not counting the spectrum of halfway solutions that are possible between those two extremes of completely reversing the transactions or completely taking the 10 BTC hit.)

@Dan Added a paragraph describing the main alternative.


text:
How do nodes come to a consensus on difficulty?
Specifically I would like to know what messages are sent between nodes in order to figure out total processing power of the network and therefore difficulty. How is the new difficulty value spread through the network and what if nodes do not agree on it?

Possible duplicate of http://bitcoin.stackexchange.com/questions/5838/how-is-difficulty-calculated.

There is no coordination done specifically for difficulty calculations. The difficulty is computed deterministically based on the data in the blockchain (shared among all nodes), specifically the timestamps of blocks.


text:
How do I interpret Mt Gox market depth streaming data?
You can get streaming market depth data form Mt Gox as described here: https://en.bitcoin.it/wiki/MtGox/API/Streaming#Depth.
I understand what market depth is but how do I interpret this data?
An edited example of a JSON market depth response at the above link is:
{
    "currency":"USD",
    "item":"BTC",
    "now":"1323644358437819",
    "price":"14.43",
    "total_volume_int":"849766000",
    "type_str":"ask",
    "volume":"-2.71",
}

What does volume, total_volume_int and price relate to? What insight do I get from this?
I understand the market depth charts at http://bitcoincharts.com/markets/mtgoxUSD.html but how does the above JSON data relate to them?

I understand now that each piece of JSON depth data is actually an order entering the order book. Therefore in the example someone wants to sell 2.71 bitcoints for 14.43. However can someone tell me what total_volume_int means?

Mt Gox JSON Depth Data
Market depth is a snapshot of the currently open bid(buy offers) and ask(sell offers).
A definition from Investopedia: Depth of Market
Each time a new order enters Mt Gox's order book the real-time depth API broadcasts this to the end user. If you listen long enough to the Mt Gox's depth API you would be able to gain an almost accurate copy of Mt Gox's order book.
Interpreting the Data
volume: this is the amount of item (BTC) that the depth at that price in currency (USD) has changed by. This has been deprecated in favour of volume_int. Basically it is the same thing except the volume_int must be divided by 1E8.
price: the price point in currency to which this depth record relates.
total_volume_int: since volume / volume_int are change records total_volume records how much is available at that price point. A zero value means that no more orders are at this price point. For most purposes total_volume_int is the number you want to use.
How depth data relates to the charts
I'm assuming that the question refers to the live charts. That chart is built by forming points between price and the accumulated depth working outwards from the market price. Then those points get connected. For example:
For bid orders of 10 @ $90, 10 @ $80 and 10 @ $70 the graph would show depth accumulation of: 30 @ $70, 20 @ $80 and 10 @ $90.
Using the data
Depth information is useful to determine just how much "liquidity" there is in the market. This indicates how much a "large" transaction will move the market price.
A steep accumulated depth line indicates potential "support" on the bid side and "resistance" on the ask side. A steep chasm formed by both sides of the accumulated bid/ask depth indicates price stability while a spread out flat bowl indicates price sensitivity.
(bid, ask, liquidity, support, resistance are stock trading terms -> look them up on investopedia, it's a good resource)

Thanks for the information. I added an extra section with what I wanted to know. Please edit it as you wish. I'll mark the question as answered shortly.

I moved your section to the top and tried to improve readability throughout.


text:
How do I find out the miners fee for my transaction using Blockchain.info API?
Blockchain.info gives you the options of 'frugal', 'normal' and 'generous' for setting miners fees and leave it slightly vague as to what the transaction fee will ultimately be.
I want to use their Make Outgoing Payments API to send payments but how can I know what they choose as a transaction fee?
What if I have 0.01 BTC in my wallet and want to send it all to an address. There won't be enough BTC left over for a fee. What happens then?

There really isn't a standard fee value. Various clients implement different amounts. For example on my MultiBit installation it's currently set to 0.0001 BTC per 1000 bytes of transaction size.
You must include a fee otherwise miners won't confirm your transaction.
For Blockchain.info's case, using their API, if you don't have the $fee parameter, Blockchain.info will automatically add 0.0005 BTC in fee, which is the default value.

All transactions include a 0.0005 BTC miners fee.

So if you send 0.01 BTC with their API, and don't specify the $fee parameter, it will add a 0.0005 fee to your transaction.
EDIT This means you actually need at least 0.0105 BTC (0.01 + 0.0005) in your wallet to make the transaction. If you want to send all of the 0.01 BTC, you have to actually send 0.0095, otherwise the transaction won't go through.

The API docs say all transactions include a 0.0005 BTC miners fee by default however the Account->Settings->General says they 'Follow the fee policy suggested by the mainline bitcoin client' if you select 'Normal' Default Fee Policy. I guess that must also be 0.0005 BTC or would it depend on the transaction size in bytes and in BTC?


text:
How do you determine which position a block is in the blockchain?
I want to create a difficulty calculator and need to know when each 2016th block has been created and how many blocks were created in the previous two weeks.
Do I have to count and label each block from the genesis block up manually or is there an easier way without having to download and parse the entire blockchain or use an external service?

To find the height of a block with only the raw blockchain (or block header) data, you need to follow through the sequence of references all the way to the genesis block.
Of course, there are external services offering this information in their API.
As for your premise, to calculate difficulty you don't need to know how many blocks were created in two weeks, only how much time passed for 2016 blocks (or actually 2015 blocks due to an off-by-one bug).

I use bitcoin Abe (MySQL DB) to parse the block chain so I can import it into Matlab for analytics. There is what appears to be a network attack around block_id 225503. To get around this and other orphan blocks, I started in the block table and queried SELECT block_id,block_height,block_ntime,block_total_satoshis,prev_block_id FROM abe.block WHERE block_id=" block# " I then used prev_block_id and started at the most recent block in the block chain and worked iteratively backwards using the prev_block_id to pick the next block_id.


text:
What limitations are there to creating a Bitcoin client on Google App Engine?
I want to create a Bitcoin client on App Engine with equivalent protocol functionality to bitcoind.
With the new Sockets API available in Python and Java I believe this would almost be possible.
The only hurdle I see is that other clients would not be able to broadcast their new transactions to the App Engine client as the Sockets API does not support listen sockets. The App Engine client would have to continually poll other clients to check for new transactions and blocks.
Are there any more App Engine limitations which would get in the way of creating a client with identical protocol functionality to the bitcoind standard client?

possible duplicate of Is it possible to run Bitcoin on Google App Engine? / alternatives?

@NeilNeyman this question is similar but not the same. I am not asking if it is possible to use App Engine as a bitcoin client, because I know it is. I am asking how close to bitcoind can you get with the sandbox restrictions enforced by App Engine. The only limitation I can think of is as mentioned in my question. Are there any more?

I see, ok sorry. Probably worth leaving this question there as a sort-of follow-up.


text:
With the Bittrex BTC-BCH pair how do I order enough BCH to exactly spend one BTC?
Bittrex orders have their lot size/quantity in BCH and price in BTC. If I only have one BTC in my wallet how can I convert it all to BCH?
To ask another way: How do I know the exact quantity of BCH to order so that I fully convert my one BTC to BCH.
Note this question applies to other pairs and other exchanges. I am also looking for how fees would come into the equation as if I request too much BCH there might not be enough BCH in my wallet to cover fees.

Thanks for adding another question with additional clarification.
Assuming the interface has stayed the same since May-July 2017 for Bittrex, there won't be a reliable way to accomplish this. This also occurs in other exchanges.
If i submit a trade and want to pay .002 BTC per 1 BCH, that's the upper LIMIT. You can't "force" it to buy BCH that high. It just won't buy anything at a cost greater than .002. In any normal scenario nor would anyone want to pay more than necessary to obtain the desired amount. Most systems work on a "this is what i want to buy, this is how much i'll pay for it". With an order book, if the system can buy it for you cheaper, it will. You are simply setting your upper limit. Thus it's called a "limit order". Limit trading is the most popular because the system will not pay more than what you've specified in reaching the amount of BCH you've specified. Going back to the example, if the system found some BCH for you at a price of .0019, it'll sell it to you for that price.
In every system i've used that has limit orders, there is always left over. It's almost impossible to get a 1:1 ratio. I have benefited greatly from sudden fall's in market price on big purchases because my orders were completing for far less. The same for the sell side. In a sudden shift up in price, i found myself getting more for my sales because people were paying more.
This does have an unintended consequence. You'll have change. Sometimes the change is so small it won't even display. I have about .. 15 currencies all showing zero in Kraken, but actually have a tiny fraction remaining because of this very reason. Can't create a sell order for such a small quantity. Not willing to pay the withdraw fee as the fee is exponentially higher than the tiny value.
I get that it can be annoying, there just isn't a desire to implement something that does a "give me only what i ask for even if it's not a benefit to me". Might even be illegal in the US to "inflate" the purchase price to a buyer just to make sure there is nothing left over.
In sum: There is no way to get the system to provide a 1:1 trade of exactly what you want to sell for the specified price. There is also no way to "calculate" the price unless the system sat still for an extended period with no volume. Anything you attempt to calculate on screen could already be made irrelevant in the back end via API or other traders.
The only other option for getting rid of an "exact value" would be to withdraw it and sell it elsewhere. Shapeshift would be a good example. There you can mess with the values to spend exactly 1 BTC, or enter 1 BTC and it will simply tell you how much BCH you'll get. It's not an order book with a system trying to match up trades.
Note: Basing this "Bittrex" specific information based on some Youtube video's of the exchange and this article: https://medium.com/@scozky/getting-started-with-trading-on-bittrex-55237f482ef5. The bulk of the knowledge was used to confirm that Bittrex uses a system that is almost exactly the same as every other "advanced" trading system (IE: Coinbase = simplistic. No limit prices. You get what they decide to give you) that implements usage of "limit orders".
EDIT: I missed the "fee" aspect here. You'll never "not have enough" The fee's are percentage based. Trade occur in small slices since the system is matching you as a buyer, up to someone else who is a seller, for equal to, or less than your limit. If you wanted to buy 1 BTC at .002 per BCH.. and it found someone that will sell 1 BCH for .002, they take their fee off THAT trade. The trade was worth 1 BCH. When they take 0.25% (assuming their zendesk post is accurate) you get 0.9975 BCH. They keep .0025 BCH as "the fee".
https://bittrex.zendesk.com/hc/en-us/articles/115003684371-BITTREX-SERVICE-FEES-AND-WITHDRAWAL-LIMITATIONS
Final Note: I'm over simplifying the limit system for Bittrex as this isn't part of the question.


text:
Is there a way to squeeze more hashing rate from a weak hardware?
I have a computer has two graphic cards ATI Radeon HD 5450, which are almost not used at all.
The computer is running permanently and is used only for office work and data storage.
I tried to setup the minig there and I was i bit disappointed by the hashing power.
GuiMiner was hasning at 2 x 10Mh/s, CGMiner is a bit better, it does 2 x 14Mh/s.
Are those graphic cards so weak that it is not possible to squeeze a bit more out of that?
I can get a third of this hashing rate on the CPU of my 5 years old notebook.
I use just the default settings and I mine by executing cgminer -o host:port -u user -p password -l 1 -T

12-14Mh/s is about right for the 5450. It's not that the card is weak, it's just that you're trying to make it do something it was never designed to do.


text:
Remove public address from my wallet
I have generated few fancy bitcoin addresses with vanitygen. I was looking on some webpage how-to-add the address into my bitcoin wallet.
I accidentally entered the example private key instead of my generated one.
Now I have in my wallet someone else's address and plenty of transactions.
Is there a way how to remove that address from my wallet?
I did more actions since the last backup.
The only way I came to is to backup private keys from my wallet and add them to some empty wallet.

What wallet client are you using?

I have the original bitcoin client (bitcoind + bitcoin-qt)

Jackjack's fork of pywallet will allow you to delete a private key, reportedly.

http://pywallet.tk
http://bitcointalk.org/index.php?topic=294439.0