text:
OpenSSL error when running "make" command
I am trying to install bitcoin core on my ubuntu server.
installed necessary dependencies.
RAN :
./autogen.sh
./configure --disable-wallet --with-incompatible-bdb --with-gui=no
./configure
make
I am getting OpenSSL errors when I run make.

bignum.h:593:77: error: cannot convert ‘const CBigNum*’ to ‘const BIGNUM*’ {aka ‘const bignum_st*’}
593 | inline bool operator>(const CBigNum& a, const CBigNum& b)  { return (BN_cmp(&a, &b) > 0); }
|                                                                             ^~
|                                                                             |
|                                                                             const CBigNum*
In file included from /usr/include/openssl/asn1.h:23,
from /usr/include/openssl/objects.h:15,
from /usr/include/openssl/evp.h:28,
from /usr/include/openssl/x509.h:18,
from /usr/include/openssl/ssl.h:20,
from /usr/include/boost/asio/ssl/detail/openssl_types.hpp:24,
from /usr/include/boost/asio/ssl/context_base.hpp:19,
from /usr/include/boost/asio/ssl/context.hpp:23,
from /usr/include/boost/asio/ssl.hpp:18,
from rpcprotocol.h:16,
from rpcserver.h:10,
from bitcoind.cpp:6:
/usr/include/openssl/bn.h:274:26: note:   initializing argument 1 of ‘int BN_cmp(const BIGNUM*, const BIGNUM*)’
274 | int BN_cmp(const BIGNUM *a, const BIGNUM *b);
|            ~~~~~~~~~~~~~~^
make[3]: *** [Makefile:865: bitcoind.o] Error 1
make[3]: Leaving directory '/root/bitcoin/src'
make[2]: *** [Makefile:887: all-recursive] Error 1
make[2]: Leaving directory '/root/bitcoin/src'
make[1]: *** [Makefile:673: all] Error 2
make[1]: Leaving directory '/root/bitcoin/src'
make: *** [Makefile:509: all-recursive] Error 1

I did run sudo apt-get install libssl-dev but it doesn't help.

What version of Bitcoin Core is this? Modern versions don't use OpenSSL at all anymore.

@PieterWuille 0.9.5

That's almost 6 years old. I suggest you use 0.21.0 (which was released 2 weeks ago), or at least something that's still supported.

@PieterWuille Thank you. Using version 0.21.0 solved my problem


text:
I can't send a transaction from electrums cli
I am trying to send a transaction in the cli using electrum with the command ~$

electrum --testnet payto mvYrQck9VfujSanmwvQxiLab3fLuywGdvh 0.01 -f 0.002

Password: (I entered the correct password here)
Q
{
    "complete": true,
    "final": true,
    "hex": "0100000001c36cdc20a497f12731f96b89f830d2743245c4adc1f4a622b8c2e234821cd76e7f0000006a4730440220028106ef3432af605c882db4d9065e318ee6a7513e7731d83a01d3a156985c1d0220256e6213c0bc59f63239a9375636228a6e601b02822bfb28f31adcc15d42e7da0121031720b63d82383198cf67c770d6f8c00877d2721bcb2308ad0717685d706aba55feffffff0240420f00000000001976a914a4e5cdf9a742245b2cb4254640ee2aa16e95809e88ac2cd1cf00000000001976a91457054c8af735007871b7a3697c5736280f59183f88acbd8d1500"
}
but when I open electrums gui I don't see the transaction in the history tab and my balance remains the same.

I think you need to launch the daemon and broadcast the transaction:
electrum --testnet daemon start
electrum --testnet broadcast 0100000001c36cdc20a497f12731f96b89f830d2743245c4adc1f4a622b8c2e234821cd76e7f0000006a4730440220028106ef3432af605c882db4d9065e318ee6a7513e7731d83a01d3a156985c1d0220256e6213c0bc59f63239a9375636228a6e601b02822bfb28f31adcc15d42e7da0121031720b63d82383198cf67c770d6f8c00877d2721bcb2308ad0717685d706aba55feffffff0240420f00000000001976a914a4e5cdf9a742245b2cb4254640ee2aa16e95809e88ac2cd1cf00000000001976a91457054c8af735007871b7a3697c5736280f59183f88acbd8d1500

source: Stack Exchange

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

sort: votes


text:
Signing a large file with Ardor Account
I want to sign a file (a picture of 1.4 Mb) with my Ardor Account, in order to have a timestamped proof of ownership.
I tried the generateFileToken API, but it seems to work just with smaller files (no more than 40 kb).
How could I do it?

You need to increase the max file upload size of your node using the nxt.maxUploadFileSize property in nxt.properties.
For example, set:
nxt.maxUploadFileSize=10000000

To set the limit to 10MB

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


text:
bundler configuration to accept 1 ms currency to 1 account (Ardor)
I want to make a token that would be used as "gift card". So, when one person send it back to my account, I want to pay the transaction fees (in order to let people who haven't got ignis claim their gift).
So I need to set a bundler that only bundle, for free, transactions of this token to my account.
In testnet,
this is the token: 8633185858724739856 (the ms currency GIFTZ@IGNIS)
this is my account: ARDOR-JHA7-XH2W-HMF4-CYQ7W
How should I configure the bundler?

With Ardor 2.1.0e you can start a bundler which bundles only transactions with certain currency. Use CurrencyBundler filter with parameter the currency ID.
If you want to additionally filter only transactions sent to your account, you'll have to either write a new filter for that like
public class RecipientBundler implements Bundler.Filter {

    @Override
    public boolean ok(Bundler bundler, ChildTransaction childTransaction) {
        return bundler.getAccountId() == childTransaction.getRecipientId();
    }

    @Override
    public String getName() {
        return "RecipientBundler";
    }

    @Override
    public String getDescription() {
        return "Only bundle the transactions sent to the bundler account";
    }

}

...or alternatively you can create the currency as controllable.
With 2.0.14 you'll have to write a filter like the one from above which checks both conditions - that the transaction is transferring your currency and that the transaction is transferring it to your account.
EDIT:
More details about the bundling in Ardor 2.1 can be found in nxtwiki


text:
How do I set 'txindex = 1' in bitcoincore?
How do I set 'txindex = 1' in bitcoincore?
I installed it on linux ubuntu.
I can not find the /home/bitcoin/bitcoin.conf file.
Path to '/home/bitcoin/share/examples/bitcoin.conf'The bitcoin.
conf file is found, but there is no place to set txindex = 1 inside.

If you installed Bitcoin Core on linux, the config file is most likely found in ~/.bitcoin/bitcoin.conf
Edit bitcoin.conf file and just add txindex=1 anywhere you like on a new line, just make sure it's not commented out.


text:
How to Back-up and Withdraw Bitcoins to My Mastercard
Please help me. I am new to bitcoin wallet and I would like to know how to back up my wallet and how to withdraw bitcoins to my mastercard or debit card.

Which wallet? Bitcoin-core, Electrum, Mycelium, Exodus, Bread, Wasabi, ...

Hi Bubbly, it sounds like you're asking about two distinct topics. 1) How to create a backup of your wallet, 2) How to sell bitcoins and receive the revenue to your bank account. For the former, as RedGrittyBrick indicated, we would need to know what software you are using, the latter may be a duplicate of https://bitcoin.stackexchange.com/q/17239/5406. Generally, our site works best if each question only inquires about one topic, though.


text:
Openssl errors when building the bitcoin-core on macOS
I have been trying to build bitcoin-core on macOS as I am reading the "Mastering Bitcoin" book from Andreas Antonopoulos.
I read the instructions for building the the bitcoin-core on macOS from the doc/build-osx.md file in the bitcoin repository and I installed all the libraries that are needed ( following the build-osx.md file ):

brew install autoconf automake libtool boost miniupnpc openssl pkg-config protobuf qt ( Also I installed a bunch of other libraries that I hoped would solve the issue, such as sqlite python libevent qrencode
The docs say "You should see OpenSSL 1.0.1f 6 Jan 2014." however now we have version 1.1.1k in 2021 as I am writing this. And also it asked me to do brew link openssl --force which I did.
I installed berkeley-db4, but I did with brew install berkeley-db@4 since the link that is provided in the bitcoin docs doesn't work - brew install https://raw.github.com/mxcl/homebrew/master/Library/Formula/berkeley-db4.rb -–without-java
I have Xcode and its Command Line Tools
Then I did the ./autogen.sh , ./configure and make. The ./configure went alright, without any errors, however when I type make I get the following errors.

/usr/local/include/boost/bind.hpp:36:1: warning: The practice of declaring the Bind placeholders (_1, _2, ...) in the global namespace is deprecated. Please use <boost/bind/bind.hpp> + using namespace boost::placeholders, or define BOOST_BIND_GLOBAL_PLACEHOLDERS to retain the current behavior. [-W#pragma-messages]
BOOST_PRAGMA_MESSAGE(
^
/usr/local/include/boost/config/pragma_message.hpp:24:34: note: expanded from macro 'BOOST_PRAGMA_MESSAGE'
# define BOOST_PRAGMA_MESSAGE(x) _Pragma(BOOST_STRINGIZE(message(x)))
                                 ^
<scratch space>:85:2: note: expanded from here
 message("The practice of declaring the Bind placeholders (_1, _2, ...) " "in the global namespace is deprecated. Please use " "<boost/bind/bind.hpp> + using namespace boost::placeholders, " "or define BOOST_BIND_GLOBAL_PLACEHOLDERS to retain the current behavior.")
 ^
In file included from bitcoind.cpp:9:
In file included from ./main.h:13:
./bignum.h:56:24: error: base class has incomplete type
class CBigNum : public BIGNUM
                ~~~~~~~^~~~~~
/usr/local/Cellar/openssl@1.1/1.1.1k/include/openssl/ossl_typ.h:80:16: note: forward declaration of 'bignum_st'
typedef struct bignum_st BIGNUM;
               ^
In file included from bitcoind.cpp:9:
In file included from ./main.h:13:
./bignum.h:61:9: error: use of undeclared identifier 'BN_init'
        BN_init(this);
        ^
./bignum.h:66:9: error: use of undeclared identifier 'BN_init'
        BN_init(this);
        ^
./bignum.h:67:14: error: no matching function for call to 'BN_copy'
        if (!BN_copy(this, &b))
             ^~~~~~~
/usr/local/Cellar/openssl@1.1/1.1.1k/include/openssl/bn.h:219:9: note: candidate function not viable: no known conversion from 'CBigNum *' to 'BIGNUM *' (aka 'bignum_st *') for 1st argument
BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b);
        ^
In file included from bitcoind.cpp:9:
In file included from ./main.h:13:
./bignum.h:69:13: error: no matching function for call to 'BN_clear_free'
            BN_clear_free(this);
            ^~~~~~~~~~~~~
/usr/local/Cellar/openssl@1.1/1.1.1k/include/openssl/bn.h:218:6: note: candidate function not viable: no known conversion from 'CBigNum *' to 'BIGNUM *' (aka 'bignum_st *') for 1st argument
void BN_clear_free(BIGNUM *a);
     ^
In file included from bitcoind.cpp:9:
In file included from ./main.h:13:
./bignum.h:76:14: error: no matching function for call to 'BN_copy'
        if (!BN_copy(this, &b))
             ^~~~~~~
/usr/local/Cellar/openssl@1.1/1.1.1k/include/openssl/bn.h:219:9: note: candidate function not viable: no known conversion from 'CBigNum *' to 'BIGNUM *' (aka 'bignum_st *') for 1st argument
BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b);
        ^
In file included from bitcoind.cpp:9:
In file included from ./main.h:13:
./bignum.h:83:9: error: no matching function for call to 'BN_clear_free'
        BN_clear_free(this);
        ^~~~~~~~~~~~~
/usr/local/Cellar/openssl@1.1/1.1.1k/include/openssl/bn.h:218:6: note: candidate function not viable: no known conversion from 'CBigNum *' to 'BIGNUM *' (aka 'bignum_st *') for 1st argument
void BN_clear_free(BIGNUM *a);
     ^
In file included from bitcoind.cpp:9:
In file included from ./main.h:13:
./bignum.h:87:37: error: use of undeclared identifier 'BN_init'
    CBigNum(signed char n)        { BN_init(this); if (n >= 0) setulong(n); else setint64(n); }
                                    ^
./bignum.h:88:37: error: use of undeclared identifier 'BN_init'
    CBigNum(short n)              { BN_init(this); if (n >= 0) setulong(n); else setint64(n); }
                                    ^
./bignum.h:89:37: error: use of undeclared identifier 'BN_init'
    CBigNum(int n)                { BN_init(this); if (n >= 0) setulong(n); else setint64(n); }
                                    ^
./bignum.h:90:37: error: use of undeclared identifier 'BN_init'
    CBigNum(long n)               { BN_init(this); if (n >= 0) setulong(n); else setint64(n); }
                                    ^
./bignum.h:91:37: error: use of undeclared identifier 'BN_init'
    CBigNum(long long n)          { BN_init(this); setint64(n); }
                                    ^
./bignum.h:92:37: error: use of undeclared identifier 'BN_init'
    CBigNum(unsigned char n)      { BN_init(this); setulong(n); }
                                    ^
./bignum.h:93:37: error: use of undeclared identifier 'BN_init'
    CBigNum(unsigned short n)     { BN_init(this); setulong(n); }
                                    ^
./bignum.h:94:37: error: use of undeclared identifier 'BN_init'
    CBigNum(unsigned int n)       { BN_init(this); setulong(n); }
                                    ^
./bignum.h:95:37: error: use of undeclared identifier 'BN_init'
    CBigNum(unsigned long n)      { BN_init(this); setulong(n); }
                                    ^
./bignum.h:96:37: error: use of undeclared identifier 'BN_init'
    CBigNum(unsigned long long n) { BN_init(this); setuint64(n); }
                                    ^
./bignum.h:97:37: error: use of undeclared identifier 'BN_init'
    explicit CBigNum(uint256 n)   { BN_init(this); setuint256(n); }
                                    ^
./bignum.h:101:9: error: use of undeclared identifier 'BN_init'
        BN_init(this);
        ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
1 warning and 20 errors generated.
make[3]: *** [bitcoind.o] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all] Error 2
make: *** [all-recursive] Error 1

I thought it was something with the openssl version so I have been trying to fix it by installing an older version but brew gave me errors everytime I tried something new. Now I have the latest version of openssl which is 1.1.1k. I am not sure what I am doing wrong.
I would appreciate any help I can get. Thanks

What version of Bitcoin Core are you trying to build? Openssl is no longer a dependency since 0.20

@AndrewChow I am trying to build v0.9.5rc1

I switched to v22.0rc2 and the problem seems to have been fixed. Thank you.


text:
Optimal way to design BTC deposit flow?
I am designing an exchange application where users can deposit funds into their account by sending BTC to a unique address.
What is the best way to monitor 100,000+ addresses for incoming transactions that meet a certain number of minimum confirmations?
One approach would be to listen to the rawtx event using ZMQ in order to discover new transactions, then write a program to periodically query the number of confirmations for each transaction using JSON-RPC. However, this method seems slow since it would involve repeatedly hammering the node with RPC calls. I do not wish to use external APIs like https://blockchain.info.
What would be the most efficient way to accomplish this?

Actually, there is no need to periodically query the node for the number of confirmations. The number of confirmations is implicitly given by the block height where the transaction was confirmed and the current block height.
The following assumes you store your 100,000+ addresses in a database with reasonably fast lookups, that it can also store additional data, and that you index columns that you use in queries.
Only confirmed transactions
The problem is quite simple if you only need to track transactions once they get their first confirmation. Listen for the rawblock ZMQ event, go through all transactions, and whenever a transaction sends to an address you're tracking, add this transaction to the database along with the block height where it was confirmed. Then, if you want perform some action after e.g. 3 confirmations, when a new block arrives, just look up transactions confirmed 3 blocks earlier. Depending on what it is you do, for extra robustness you might want to keep track of which confirmed transactions were already successfully acted upon.
Unconfirmed transactions
If you also want to show unconfirmed transactions, it gets more complicated as transactions might get replaced or dropped from your node's mempool. See this question on how to potentially deal with this. Whatever approach you use, the rest is the same as above.
Catching up
If your application has to restart or crashes, you might miss blocks. To guard against this, you can keep track of the last processed block height, and on startup query the node for the current block height. If you find out you're behind, just query the missing blocks (using the getblock RPC) and process them as usual.
Reorg safety
There are a few extra steps in order to make your application work correctly in the event of a chain reorganization. An approach I've found to work well is to store a few* recent block headers** (just the hash and height is enough), and when a new block arrives, follow its previous block hash (using the getblockheader RPC) until your database has the same block hash at that height as your node, then rollback any transactions made after that height. If no reorg has happened, the latest common header will just be one block behind the new chaintip, so you won't need to rollback anything.
* If you're not worried about a few tens of MB's of storage, you can just as well store all block headers.
** Storing block headers is also a convenient way of keeping track of what was the last block you processed.


text:
Visual Studio Compilation errors in V21.1
I have successfully downloaded the source for Bitcoin Nodes V19 and V20 and built them in Visual Studio but get compilation errors when trying to do the same with V21.1. I have reloaded all dependent software packages (Boost etc) using vcpkg, reinstalled Visual Studio, redone vcpkg integrate install but it makes no difference. I am still able to compile and link V20 but not V21.
Is it possible the source code for V21.1 from GitHub is somehow wrong?
Anyone else had this problem?
Thanks,
Jon

Bitcoin Core's CI infrastructure builds and runs tests with an MSVC build, so presumably the code is fine. It's hard to tell what is wrong without seeing your actual errors.

Could you try out updated docs (see https://github.com/bitcoin/bitcoin/pull/22890), and please submit an issue with build errors to https://github.com/bitcoin/bitcoin/issues.


text:
How to get Y from X
Ok, so I get address generation now, and I understand that X is hashed, however for verification of a signature, we need the public point, (x,y)
How would one get Y from X?
Lets take an example, im gonna use my generator (0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798,0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8) and use private "10" (using a = 0, b = 7, p = 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f) to get:
(0xa0434d9e47f3c86235477c7b1ae6ae5d3442d49b1943c2b752a68e2a47e247c7,0x893aba425419bc27a3b6c7e693a24c696f794c2ed877a1593cbee53b037368d7)
Now we remove Y, to only have: 0xa0434d9e47f3c86235477c7b1ae6ae5d3442d49b1943c2b752a68e2a47e247c7
Meaning that we need to get Y from X, how would I do this? I never seen this explained really and everything I tried doesn't result in the correct Y value

The secp256k1 curve equation is:

Points (x,y) for which y2 = x3 + 7 mod p, where p = 2256-232-977

If we solve this for y, we get y = ±√(x3 +7) mod p.
Of course, this is not a normal square root, but a square root for the field of integers modulo p, but otherwise this equation is correct. To compute such a modular square root, the Tonelli-Shanks algorithm is used. It can deal with many cases, depending on the structure of the modulus, but for our p modulus it simplifies to just:

√a mod p = a(p+1)/4 mod p (for any prime p for which p+1 is a multiple of 4).

Tad confused what A is supposed to be, I assumed it was (x^3)+7 but after doing the equation for x = 72488970228380509287422715226575535698893157273063074627791787432852706183111, I got 5945770897828140901859913642993887309423255879987770157450768201525288715151 for y, which is incorrect, any chance you could help me out?

Yes, a is x^3 + 7 here. Given x=72488970228380509287422715226575535698893157273063074627791787432852706183111, you get a=x^3+7=4037741034981857009060200306242622473933214174234453045209672395016311171624 (mod p). y = a^((p+1)/4) = 62070622898698443831883535403436258712770888294397026493185421712108624767191 (again mod p). Its negation -y = 53721466338617751591687449605251649140499096371243537546272162295800209904472 is also a valid corresponding Y coordinate.

Theres mutible Y cords @W@ How would I get the one I need for my private for example without using my private? Thats kinda what im looking for to understand how bitcoin works, because im a bit confused how your supposed to get the "y" that was generated with the private

That information is normally part of the public key. In SEC encoded compressed public keys you have (0x02 or 0x03) + (32-byte X coord), with the 0x02/0x03 indicating whether Y is even or odd. In BIP340 Schnorr public keys, the Y coordinate is implicitly even, and the private key is negated at signing time if the Y coordinate would otherwise be odd.

Ok, so basically, lets say im looking for Y, but it doesn't come up when I do your function, what do I do then exactly to get the Y I need?

As I just said: you'll be looking for either the even or the odd one. Which one you need is always going to be clear from the context (it's either implied, or encoded in the public key).

Yeah, but once I look for the first Y doing a^(p+1)/4 mod p, and its not it, what do I do then?

Im getting incorrect results when doing pow(a,int((curve.p+1)/4),curve.p), I get 5945770897828140901859913642993887309423255879987770157450768201525288715151, do you know what this is about?

Is that Python? Don't use "int(.../4)", as it converts the argument to a floating point number, losing precision. You need integer division here which avoids that conversion (use "...//4" instead).


text:
Do Electrum Wallets accept BCH?
I bought BCH from Bitcoin.com and provided an Electrum Wallet Address. The money did not arrive and Simplex, who arranged the transaction, advised that Electrum Wallets are only BTC even though the app does not mention this. Simplex sent me a link comprised of a http address on Bitcoin.com's website and the wallet address I originally provided which takes me to where my BCH is sitting but I do not know how to regain control of it and send it to a new BCH wallet. Bitcoin.com do not respond to emails. Can anyone help?

I'm voting to close this question as off-topic because it's exclusively about BCH not Bitcoin.

Electrum is a Bitcoin only application. This is directly stated by Electrum where it says it is a Bitcoin wallet. It does not say that it is a wallet for any other cryptocurrency. You cannot use Electrum for Bitcoin Cash.
To get your Bitcoin Cash, you will need to export your private keys from your Electrum wallet and import them into a Bitcoin Cash wallet. This may be easiest to do with Electron Cash which is a fork of Electrum but modified to work with Bitcoin Cash.

Simple. Download electroncash on your PC. Make a duplicate of your current wallet file and save it on your desktop. Open electroncash  and when it asks for wallet file to open, click browse and choose the duplicate file. Your coins should show up.


text:
Blockchain gets stucked if no blocks are mined
Yesterday I decided to fork a project, just for fun and to learn more about it. So, I forked a project, I generated my own genesis block, changed timestamps, nounce, keys, reset the min chain work. Everything was fine. Compiled it for Windows and Linux, it worked perfectly. I set up a wallet on a Vultr server, the other one in my own PC, mined a few blocks and then I went to bed.
The Vultr walllet kept running, but mine didn't, I closed it.
When I woke up and opened the wallet, it was trying to download blocks. getblocktemplate basically says it is downloading blocks, but there are no blocks to download. It says "8 hours behind".
I'm not sure if this is supposed to happend.
In my ignorance I'm going to assume it is normal: how do I fix it without having to delete everything and making a new chain?
If it's not normal: What did I do wrong?

In my ignorance I'm going to assume it is normal: how do I fix it without having to delete everything and making a new chain?

You can just comment out or remove the check in getblocktemplate so it won't error there.
You should also be able to bypass this by setting your computer's clock to around the time of the most recent block before you start the software. Once it has started, you can bring your computer's clock back to real time and then mine a block.

Thanks. Why does this happens? Does it has something to do with DEFAULT_MAX_TIP_AGE?

It happens because bitcoind (and therefore everything based off of it), uses some metrics to determine whether it has a fuly synced blockchain. One of those is the age of the most recent block (aka the blockchain tip). If it is more than a few hours (2 hours IIRC), then it thinks it is out of sync and thus will not exit the InitialBlockDownload phase where somethings are locked down. getblocktemplate is coded to not mine when the blockchain isn't synced as if you could, you could inadvertently cause a fork.

Got it. Thank you Andrew. Flawless explanation.


text:
How is a transaction not present in 2 or more solved blocks?
If node A picked 10 unconfirmed transactions to solve in a block and node B picked the same 10 transaction in A plus another 10 transactions to solve. If node A finished solving the block informed all nodes and placed the block on the chain, what happens to the same transactions being mined by Node B?

Since node B didn't find a block, nothing it does has any effect. As miners find out about the block mined by A and confirm that it is valid, they'll start working on a new block to come after that block. They'll include some subset of the transactions that can be validly included in a new block after the block mined by A.
Transactions already included in the block mined by A are not valid in a block after it because their inputs no longer exist. Transactions that try to consume those same inputs (if there are any) would also no longer be valid. Any transactions still valid (whether or not B tried to include them) might get included in the candidate blocks that miners work on after that.
Effectively, every time a valid block is found, miners start over working on finding a new block to go after it. They have to recompute which transactions to include in that new block. If they include a transaction that's now invalid, any block they mine will be invalid. If they fail to include valid transactions that pay high fees, they'll reduce their income should they find a block. So miners are incentivized to try to pack the blocks they find with valid transactions that pay high fees relative to the block space they occupy.

Thanks David S, I think you last paragraph sums it up for me. When a block is solved all miners will go and fetch new valid transactions to put into the block they are about to mine. Therefore it is practically impossible to have 2 blocks solved successfully by 2 miners at the same time and they happened to share some valid transactions in their blocks. Only one block will be chosen to be linked to the chain, the other must be thrown away even if it was successfully mined at the same exact time.

@DavidVella Right. Every block includes a reference to the block before it, so they can't both exist in the same chain regardless of whether they have overlapping transactions or not. Eventually, one or the other of them will be embedded in the longest chain.

When node B gets informed about block A being mined he would start working on a new block that does not conflict with the first one.
If block B happens to be mined around the same time as block A there would be a fork. All nodes in the network that hear about both blocks will keep both branches and will wait for the conflict to be resolved.
The miner that mines the next block will have to place his new block on top of one of the branches. When that happens and the new block gets broadcasted, all nodes will pick the branch with the most work and the other branch will become orphan.

Thanks for your answer. So block B will get discarded as soon as A is added to the chain. There can only be one block resolved every 10 minutes.

@DavidVella No, there can be multiple blocks in a 10 minute period but they cannot contain the same transactions.This is true for any blocks. Each transaction can only be in one block.


text:
I opened a channel for 5000 sats. Why is my available balance to send only 4000 sats?
Using Lightning Dev Kit (LDK). Intuitively, it seems like the entire balance should be send-able.

This is an effect of the channel reserve, see: https://docs.rs/lightning/latest/lightning/util/config/struct.ChannelHandshakeConfig.html#structfield.their_channel_reserve_proportional_millionths.
The channel reserve is enforced to ensure each counterparty always has something to lose, if they were to try to cheat. By default, the channel reserve is 1% of the total channel capacity, and LDK sets a hard minimum of 1000sats.


text:
Is there already a way for subscription models? (Preferred over lightning)
Has anyone heard of a project that tries (or was successful) to make reliable subscription models possible? I mean a use case where the vendor can rely on his costumer and does not have to worry that he won't receive the money he expects. For example if your internet provider wants to make a two-year contract paid in bitcoin.
Lightning preferred, of course.

There is bolt12.org which is already implemented in c-lightning. The spec proposal can be found at: https://github.com/lightning/bolts/pull/798
Offers allow for lightning native recurring payments which can be used for a subscription model without the necessity of a third party.
It is not yet part of the protocol but my Feeling is that it is one of the lesser controversial proposals and that we will be getting there sooner or later.


text:
Not able to verify tor setup for RPC
I'm currently in chapter 14.1 (verify your tor setup) of the  learning bitcoin from the command line course by blockchaincommons.
I don't get my head around doing the actual RPC verification via torify and I assume my linode-node is not running properly behind tor.
When I type sudo -u debian-tor tor --verify-config everything is fine and I see the expected result.
However when I try to check the rpc ports in /etc/tor/torrc I can NOT see the hidden service ports described in the docs. There it only says:
############### This section is just for location-hidden services ###

## Once you have configured a hidden service, you can look at the
## contents of the file ".../hidden_service/hostname" for the address
## to tell people.
##
## HiddenServicePort x y:z says to redirect requests on port x to the
## address y:z.

#HiddenServiceDir /var/lib/tor/hidden_service/
#HiddenServicePort 80 127.0.0.1:80

#HiddenServiceDir /var/lib/tor/other_hidden_service/
#HiddenServicePort 80 127.0.0.1:80
#HiddenServicePort 22 127.0.0.1:22

I can see them in the bitcoin.conf file but that doesn't help much... I have an QR-code but I'm not able to connect with my node through it. And I don't have a /var/lib/tor/standup/hostname directory at all.
What I CAN do is verifying my tor-setup for bitcoind running grep "tor:" ~/.bitcoin/testnet3/debug.log.
I assume, something went wrong during the initial install. But can anybody tell me, how to fix it?
PS: Explanations for differences between RPC and bitcoind are also welcome, I think I'm not getting that right either...

At the top of the guide you linked, it mentions setup with Bitcoin StandUp. I can see that the Linux StandUp script should have set the ports in torrc. Did you use this script?

Might checkout the tor guide in bitcoin-core.  If your using "option 2" then core is making the Tor service for you via the Tor API.

@meshcollider yes I did us Bitcoin StandUp. Question is, can I simply add them manually in the displayed section above?

@zerotobtc I think the setup is more complicated than just adding those lines to the file. I'd recommend using the Tor setup guide linked by Dan

Thanks @Dan for the link to the setup guide, that helped!

I still don't know why the error occurred however I found a workaround.
I added the lines
HiddenServiceDir /var/lib/tor/standup/
HiddenServiceVersion 3
HiddenServicePort 1309 127.0.0.1:18332
HiddenServicePort 1309 127.0.0.1:18443
HiddenServicePort 1309 127.0.0.1:8332

in the /etc/tor/torrc file (according to the tor guide) in the hidden service section. Then I restarted tor with systemctl restart tor. Afterwards the /var/lib/tor/standup/hostname file was created and also the torify command went through just fine!


text:
CLI command "createwallet" does not work on testnet VM
I have a headless virtual machine to try out some stuff in testnet. Strangely, I can not use the createwallet command. It gives me the error
error code: -32601
error message:
Method not found

This is the case for all wallet-related commands. It cannot be because I'm missing Berkeley DB, can it? Because for newly created wallets I read it's not needed.
One additional point: I'm still syncing up with the testnet chain. But this shouldn't be an issue in my opinion.
Maybe I somehow did compile core without a wallet (but I don't know how to disable a wallet during installation)...
Help much appreciated!

Berkeley DB is only needed for legacy wallets (not the current wallet) but sqlite3 is needed. You have that installed?

you're right, I didn't install berkeley DB. Can I fix this without having to setup a totally new node? If yes, how?

I have almost 100% confidence that you compiled your core without wallet. How did you compile it? Your environment has all required decencies? Did you use a custom config flag?

I didn't use a costum config flag but I forgot installing sqlite... Dunno how to reconfigure yet though


text:
Reconfigure Bitcoin Core to allow Wallet
I installed and configured a testnet node but I forgot to install sqlite so all wallet-related commands do not work... Is there a way to fix that without having to setup a whole new node? Thanks!

You can just recompile with the wallet enabled, and restart.
It won't need to redownload things, as the bulk of the work in setting up a node is synchronizing with the network. The resulting database is the same whether there are wallets or not.

So just install sqlite and then run make && make run again? Or also configure ?

Also configure.


text:
Bitcoin split payment API? (Adaptive Split Payment)
Currently our site works with "stripe marketplace" and we trying to also implement bitcoins.
I would like to know that Bitcoins API can give me a split payment service?
For example: From buyer to seller and to us (3%) all at once. All instant without holding money.
Any alternatives?

Yes and no. I read it, but don’t really understand where to start


text:
Is there any commands i put in the core that will suggest my account is from early days
Have you got anything i could put in the core that will point back towards or leave a clue to age of my account ,ie getdesendant/ansestors, mininginfo,or blockinfo, will any of these commands tell me anything about my account?

You can open the console (Window | Console, or Ctrl-T) and use the listtransactions command with "*" as the label, 10 (or whatever) as count, and keep running it with higher values for "skip" until you get the last transaction, and look up when it happened.  This only tells you the date/time of the first bitcoin you received.  Feel free to use this to answer your own question.  How old a bitcoin-core account is seems like a good question, so I vote to keep this open.

As I've already told you in another question: no, the only way to get access to an old wallet in Bitcoin Core is having a copy/backup of your wallet.dat file.

ok cheers ,bit rusty on this stuff now used to be good back in my younger years,lol

Got it found out whats been going on and what happened wont say now need bit more time space but got a bit of work to do still, most prob be back in touch for info on segwit, also p2wpkh ,and base58 as was reading some code lastnight and very intrested on learning bit more.


text:
bitcoin file function folder location testnet setgenerate true
can somebody help me to point out where and in wich file the setgenerate true testnet function is located and controlled is it in chainparams.ccp or somewhere else ? and where to change the bitcoin testnet block memory to reset it .and to be able to test starting with zero blocks in testnet ?and i dont need to know regtest is the thing for you im learning the code and not testing .
so i really like to know how the setgenerate true is turned of and on in the code and where the block memory is located . because i removed block data in .bitcoin and deleted seeds but still my testnet is saying 3 years loading where is this comming from ?
al help is welcome
thanks in advance

The setgenerate RPC has been removed in version Bitcoin Core v0.13, in 2016.
Use the generateblock or generatetoaddress RPCs instead.

thanks for your reply | can you explain exactly what the mining command is going to be with generateblock? and do i put this like this bitcoin-cli blockgenerate or in the console from the qt blockgenerate? and will this solo mine non stop or isn't this the same mining as set generate true 1.

I've added links to the documentation.

and pieter is there a possibilty to add an code snipped to again activate the old set generate true in the code ? an setgenerate rpc code snipped ? and in wich folder should i change/activate this if i have such an snipped .

You can make any changes you want in your own copy of the source code to add such an RPC back if you want, but you're on your own then. The software does not support it.


text:
What is the best site/tool/way for finding the RSZ values of a bitcoin transaction?
The two most popular sites for doing this are down which are https://2coin.org/ and https://2xoin.com/getRSZfromRawTX/ with no indication they'll ever return to be usable.
Can anyone here link any other sites, tools or ways to find and list the RSZ values of a bitcoin transaction?

This sounds like a case of the XY problem. What do you need this values for? On themselves, they aren't useful, but they could be a means to solve a bigger problem (like e.g. debugging signer software you're writing). What is that bigger problem?

Thanks for the reply, Pieter. That's a great question I'll give a detailed answer to. I'm not debugging any signer software I'd just like those values(RSZ) listed from transactions. The hex/raw transaction has them as a whole but it's hard reading through a transaction and identifying the exact values. Every transaction has these values for everyone to see but I'd like them to organized so I don't have to sort through the scripts. I'd just like to know the values for analysis of any repeated variables/sigs. The problem here is I don't know how to. Let me know if you have an answer for me.

Are you trying to find repeated nonces, so you can derive private keys for those transactions?

Yep. But I don't know what you mean by nonces. I hope you're referring to the repeated values(k,r,etc). (I hit enter and this prematurely sends my messages even though I'm just trying to ident them so I have to reedit them to add more content) I need a consistent working site/tool/script/method for doing this. Do you have any ideas?

Yes. Thank you both for your support.


text:
Merkle tree recalculation during transaction lookup
When full-node receives a request from SPV client to check if given transaction exists in the blockchain - does it always re-calculate the merkle tree on the fly in order to return merkle path + block header to SPV client for given transaction ID?
How does it look like from performance point of view? Is there is any merkle tree caching for example? Because as I understand the node will have to do the following steps:

Find a block in which given transaction ID exists
Fetch all transactions from that block
Calculate merkle tree
Return merkle path with relevant hashes necessary to confirm merkle root

First of all: Bitcoin Core by default does not support BIP37 anymore, because it can be used as a computational, disk I/O, and bandwidth attack (because of points you bring up), and it has very weak privacy properties to begin with. It can still be enabled using -peerbloomfilters, but more modern approaches shouldn't depend on it.

Find a block in which given transaction ID exists

There is no way to issue a request for arbitrary transactions in the P2P protocol. You can only ask for recently-announce transactions (by txid, or wtxid), or for confirmed blocks (by block hash).
In the case of BIP37, it is possible for the client to send a filter of "interesting" addresses/scripts/transactions to the server, and then ask for blocks. The server will then filter the block for transactions that match the filter, and respond with those. But this does require the client to request all blocks individually - it cannot ask the server to go look for a certain transaction anywhere.

Fetch all transactions from that block
Calculate merkle tree
Return merkle path with relevant hashes necessary to confirm merkle root

These steps are right, for the case where a client asks for a filtered block from a server.


text:
How many nodes would one typically check to determine the longest chain?
Before posting a solved block to the longest chain, how many nodes would one need to check before making sure that the longest chain was found?

Each node acts independently, the Bitcoin protocol is designed so that you do not have to trust any other nodes to verify the state of the network.
If your node hears about a new block at the chain-tip, it will check to see if the block is valid according to the network's rules. Assuming the block is valid, it will be added to your local copy of the blockchain.
If your node later hears about a longer (valid) chain that doesn't include the block you just added, then you would 'reorganize' the last couple blocks, in order to create what you now know to be the longest chain. The previously accepted block would be discarded, and become what is commonly referred to as an 'orphan block'.
By this mechanism and the related game theory, the network's nodes are able to maintain consensus around the blockchain's history. The more confirmations a block has (ie blocks mined on top of it), the more certain one can be that it will not be 'reorganized', meaning the payment is more permanently included in the blockchain.

Thanks Chtrik, excellent answer. This clarifies any doubts I had on how an independent node can get information which is not residing in a central repository. Fascinating technology.


text:
Block Chain length/size may one day get unwieldy to compute
Is it possible that the length of the existing block chain will one day become unwieldy to compute? Would it make more sense that the chain would somehow be rolled up like normal bank ledgers do with opening balance for every account every year?

Is it possible that the length of the existing block chain will one day become unwieldy to compute?

A fully validating node, on first startup, will sync to the network by downloading and verifying the entire blockchain history. Doing so means validating every block and transaction in the blockchain history (but a node does not necessarily need store the entire history, it can opt to 'prune' old transactions that are not relevant to it, once they have been validated locally).
Right now, your 'average' PC will probably take a few days to sync. As the blockchain grows, it will take more computational time to validate the entire chain. Much work is being done to optimize these validation steps, with the goal being to maintain a low barrier of entry in terms of computational power.
Many of the important properties of Bitcoin (censorship resistance, immutability, etc)  are born of it's decentralized network of nodes, so working to ensure the largest number of users are able to run a full node is very important for maintaining a healthy network. The blockchain will continue to grow in size, so balancing this against computational resources is an important part of scaling bitcoin efficiently.

Would it make more sense that the chain would somehow be rolled up like normal bank ledgers do with opening balance for every account every year?

Bitcoin does not use 'account balances', instead it uses an 'unspent transaction output' (UTXO) system under the hood. If I understand correctly, what you are suggesting would be to implement a 'checkpoint' that new nodes can start from.
This would mean that a new node has to place trust in the checkpoint they have received, since they will not be able to verify the authenticity of the UTXOs as being 'real bitcoins' themselves. Bitcoin is designed to be a system that can be engaged with without having to trust any other user on the network, so doing so is somewhat antithetical to its design.
If you search for 'checkpoint' on this site, you'll find some answers such as this one, which contain more info.


text:
Why can't I connect to my Node? (on MacBook)
I just got a Bitcoin Core node running on my computer.
The next thing I wanted to do is connect Sparrow or Specter to it. But none of them are able to connect.
What can I do to make sure it's not my network settings? I'm not super knowledgable about this stuff, so talk to me like I'm 10.
Appreciate your help. please and thanks.
Thanks
Doug

Are you running macOS on your MacBook? If so, have you checked your firewall configuration? E.g. no "block all incoming connections" configuration key...


text:
Would it be possible to lose a network connection in 2009 and re anable network connection years later in 2021
I still live in the same address as I did 15 years ago 2009 I pressed the generate button on bitcoin Qt as instructed via invitation email and was actively mining bitcoin I never logged in back then as it was not needed, when plugging a different computer later but in same premises in 2021 it asked to clone to network and installed a wallet.dat file is it possible the wallet.dat file that was created in 2021 could be the same wallet.dat from 2009 if it the network re-enabled after 15 years?

No, wallets are generated on basis of random number generation which is completely unrelated to your IP address. If you don’t have a copy of your original wallet.dat, you will be unable to access the coins you mined back then.

i have a wallet.dat Murch but it was created when i reconnected to network in same house 15 years later i only pressed the button to begin mining and then left until 15 years later connected an old computer and when asked installing bitcoin-qt it ask me to connect to cloned network to what i agreed, it started up as it does but left a lot of files including PGP, GPNU, BASE58.ORACLE,FILESWALLET.DATand many many more files.

also if i have all the required files and folders and have ultimate trust keys in my name alongside Gavin Anderson i am sure theirs is a way i will be able to gain access to my mined bitcoins from 2009 if all these files and key all check out

I’m confused, do you have your original wallet.dat from the same computer as 15 years ago, or a new wallet.dat? If you have the original wallet.dat, that’s all you need. You should make a few backups of it, and then try to import it into a modern Bitcoin Core.

this is what i am saying my network was chipped but still mined these bitcoins but never registered on the network until i re conected on a computer of relatively same as back then plugged in to network and some how when connecting bitcoin qt it asked to connect to old network and started up bitcoin qt,was a bit mad after that but seen things moving around on the blockchain that was quite crazy transactions x 50 in multiple transactions happening in block 068,i have a few back ups,things going on for three weeks speak soon thank for hearing me out.

I’m having a hard time understanding what you are trying to tell me. It sounds like you have the old computer with the software from 2009. Since there were some changes in the peer-to-peer protocol since then, I’m not sure you would be able to connect to the Bitcoin network. However, any new version of Bitcoin Core should be able to synchronize your old wallet. Whatever coins you held and haven’t spent should still be available. If you have a more concrete question, please edit your post to clarify what you are asking.

If you have your old original wallet.dat file everything should be ok. If you haven't moved your funds since then they will be there. About the different computer this second wallet.dat file is different and not related to the original one.


text:
Identify original exchange from Bitcoin address on my ledger
Hi I am being asked to prove which exchange I bought Bitcoin on from several years ago. I have the BTC address on my ledger. Is it possible to trace backwards?

Does this answer your question? Can a Bitcoin address be traceable to a crypto exchange?

It is possible to trace it backwards. Some blocks chain explorers show exchange names (and other stuff) annotations on addresses and detected wallets. That kind of information is clues, but no, is not a proof.
The documentation you need is a receipt.
I have no knowledge that exchange CSV archives can be considered receipt. Chances are your corresponding revenue service will accept them, chances are not.
I would suggest you:

Get CSV archives from the exchanges you dealt with.

Inform yourself if your corresponding revenue service allows passing a CSV or requires a fully formal receipt.

Try to get formal receipts from the exchanges you dealt with.

In general, (currently) trying not to sell large quantities of Bitcoin without hiring first proper legal advisory.

Never ever do large goods and services payments with Bitcoin. That's recklessly open doors for revenue services.


text:
According to BIP44 each HD wallet have a finite number of 2^32 addresses, Why is that the case?
According to BIP32 we can have a seed from which we derive all our private and public keys, so in theory we can have an "infinite" number of child and grandchild keys so why does BIP44 limit that idea of infinity and limits HD wallets to only derive keys from the address_index the "fifth generation"

m / purpose' / coin_type' / account' / change / address_index

So in practice Bitcoin wallets following BIP44 can only generate 231 keys, furthermore only 231 possible Bitcoin addresses. Why is that the case when we can have an infinite amount of addresses?

2 billion keys within one wallet ought to be enough for everyone.
There haven't been even that many transactions in all of Bitcoin's history.

Actually I know that 2 billion keys are definitely enough (although not a good thing for privacy of shops and businesses who use Bitcoin wallet xPub for their public key derivation because in theory someone could discover all their public addresses) but my question is why limit it to 2 billion when we can have infinite amount of addresses?

That is only the limit per account. Just increment your account# by one, and you get another couple billion.
Which may as well be infinity in practice.

xPub for their public key derivation because in theory someone could discover all their public addresses

All addresses are public, anyone can see the coins balance there. That is why each address is only used once. And of course the master xPub is kept secret, same goes for Account level and below.


text:
How can double-spending occur?
I'm new to Bitcoin and trying to understand how the double-spending problem can occur and implicitly, the need for "mining".
Let's say Bitcoin worked the following way:

In the network, one node is chosen as the "moderator" node. That is, the responsibility of creating a "block" from the broadcasted transactions lies on this block and nobody else. This "moderator" node is changed every N seconds or every N block creations, etc.
From the pool of unconfirmed transactions, the "moderator" randomly picks 100 transactions. It verifies that they are legitimate (authorized) using the public keys, and it verifies that there is no "double-spend" among the selected transactions and past transactions by looking at the blockchain.
Once it verifies that all transactions are legit, it creates a block simply by putting these transactions together (that is, no mining, nothing. Simply a very fast operation) and broadcasts this block on the network.
Every node that receives the block verifies that it is legitimate. That is, they verify that the transactions are authorized by checking the public key and they verify that there's no double spend either within the new block itself, or within the whole blockchain.
Repeat.

So, what's the problem with this scheme? How can "double-spend" occur here and how can "mining" prevent it?

There are two types of double spend. The first is the easy one, solved by nodes validating the chain; the second one is the harder one, and what mining is intended to solve (or at least, disincentivize).
In both Bitcoin and the system you're describing, it is indeed easy to make sure the chain received by nodes does not contain any double spends: just validate all transactions and reject any chain which spends an output that was spent earlier within the same chain. Done.
This however does nothing about the issue of how to make sure you have the same chain as everyone else, and more importantly, have a chain that will be built on by other miners/builders in the future. See, in Bitcoin, you are never completely sure that the (valid) block you have seen will in fact remain part of the accepted chain in the future. It is possible there is another more-work chain out there you simply haven't heard about, and when you do, you'd switch to it. And when you do, a comfirmed transactions may go back to being unconfirmed, or worse, be in conflict with a transaction that is now confirmed in the new chain.
So the hard part has nothing to do with double-spends within one chain, but with ascertaining that there is consensus about what that chain is. Bitcoin does this with the most-work rule, the (otherwise valid) chain with the most accumulated proof of work in it is to be accepted as the active one. This incentivizes miners to work together, because if a block they build isn't built upon by other miners, it becomes worthless (the subsidy/fees from it are lost if it doesn't end up in the active chain).
Could your system work? Possibly, but it depends on the details, and will inevitably work under very different assumptions. First of all, how is your moderator decided, and how do you make sure that everyone agrees on who the moderator is? If not everyone agrees on this, you risk forking off nodes who believe the moderator is someone else. This is a very nontrivial problem, especially in the presence of a potentially flaky network, with potentially malicious actors who may choose to selectively not forward all messages to their peers. In fact, I believe the only solutions to this problem are either having a fixed, trusted, set of controllers who decide the moderator (centralized...), or... using proof-of-work to decide the moderator (which makes it something like DPoW). Second, what do you do when a moderator signs two different blocks at the same height, and sends one version to some nodes, and another version to other nodes? Do they learn about this, communicate with eachother, and then try to "blacklist" the moderator? Then the same problem appears: how do you make sure everyone agrees on this blacklist? There are solutions to this, but they all involve some sort of consensus mechanism to make everyone on the network agree. None of these consensus mechanisms are simple, many are flawed, and they all have their sets of assumptions which may or may not apply in the real world.
So ultimately the issue is that solving double-spending (beyond double spends within the same chain) requires a consensus mechanism. And the solution to the consensus problem in Bitcoin is Proof of Work.

A Proof of Work scheme could theoretically "fail" if a large majority of miners are malicious.
Similarly, your scheme could theoretically "fail" if a large majority of block composers are malicious.
Nakamoto 2008 "solved" the problem of choosing the next miner (Byzantine Generals) by introducing a Deus Ex Machina, the physical energy input.
Similarly, your scheme requires some Deus Ex Machine device who chooses the next block composer fairly (Byzantine Generals) in some way that a group of malicious nodes can't possibly game. If you simply work some "random" algorithm but results pseudorandom for some reason, malicious nodes will eventually figure it out and become a larger share of block composers. Then they start creating private alternative block chains and release them as necessary for them so that, by using transaction reorganization, double spend happens.
If your scheme doesn't support transaction reorganization, then it can not reliably generate blocks at a predictable pace.

But wouldn't every node verify that there's no double-spend in the blocks that they receive? That is, they would check every single incoming transaction so that it is not referenced as input to more than one transaction.

Yes, they would, but the problem with double spends is not internal to the system, but external. The double spend problem is not in the system, but in a side effect of the system. The internal solution to double spend is trivial, but the external solution is impossible.

Could you expand on what do you mean by "external"? Or point me to some resources?

Yes, of course. By external I just mean, it's related to "outside the system's rules". That is, is the side effect. That is, that means, it seemed I gave you funds, you gave me the goods or services or bearable rights, I created the double spend, so I didn't really gave you the funds, but I'm now running so fast you can't catch me (that's external to the system's rules).

So you created a transaction to send me coins, I waited until it is in the chain and then sent you the goods. This should be OK right? The only thing is, the seller might be the bad actor and not send the goods after the transaction is in the chain.

There are things to solve seller fraud, such as multisig refundable deposits, but the solution to the seller fraud problem is off topic in this post. Double spend is a buyer fraud problem.


text:
How do I set up bitcoind to track all address balances?
Bitcoind only stores information about addresses that you've added.
How do I make it store balance and transaction information for all addresses so that given any address I've never seen before, I can quickly query the information? I need responses in less than 1 second.
I dont want to use any centralized apis like blockcypher or blockchain.com.

This is not a supported feature. Only the wallet tracks total balances (per wallet even, not per address), and only does so for your own keys/addresses (including imported "watch only" keys/addresses).
Other software exists that provides this functionality.

Better check https://github.com/bitpay/bitcore or other open-source blockchain's indexer. But no bitcoind is not made to support this "top level" functionality


text:
Storing entire seed from bip39 mnemonic using WIF
I'm using the bitcoinjs collection of libraries, specifically https://github.com/bitcoinjs/wif, https://github.com/bitcoinjs/bip32 and https://github.com/bitcoinjs/bip39 with nodejs.
I have a mnemonic and can get the seed of it using bip39:
> const mnemonic = 'laptop arrest wide slice extend today jelly bachelor interest similar debris behind'
> const seed = bip39.mnemonicToSeedSync(mnemonic)
> seed
<Buffer 11 ae 55 c9 cb c0 c8 5c 09 d2 4e 36 4a 90 a6 64 09 fe 2b 87 47 79 4a 7b 03 39 76 ff 4b e9 28 59 84 74 81 cf 07 a2 7f c6 91 67 ec 04 7c a3 dc d9 23 9b ... 14 more bytes>

However, encoding it using wif and then decoding it only contains the first 16 bytes of the seed:
> wif.decode(wif.encode(0x80, seed, true)).privateKey
<Buffer 11 ae 55 c9 cb c0 c8 5c 09 d2 4e 36 4a 90 a6 64 09 fe 2b 87 47 79 4a 7b 03 39 76 ff 4b e9 28 59>

This is a problem because when I use bip32.fromSeed, the derived keys are not the same. Using bip32.fromPrivateKey solves this issue, but only if I have the chaincode, which still needs to be somehow stored separately.
What am I doing wrong? Thanks in advance. When using mnemonics, am I supposed to discard part of the seed so it aligns with the WIF?

I figured it out. You need to store the extended private key, which starts with xpriv. You can get it with bip32.fromSeed(seed).toBase58()

WIF is an encoding scheme meant for raw private keys, which are usually 32 bytes long.
A seed is not a private key, so encoding it as such is probably not a good idea.
An extended key is 32 bytes for the private key plus 32 bytes for the chain code, and more bytes for the depth and child index. Like a seed, it should not be encoded in WIF format.


text:
Antminer L3++ Where is Chain 1
Is there supposed to be a Chain 1 here also?  My other miner has Chains 1 - 4.  If so, any troubleshooting steps or way to buy new part?  Thanks! :)

As there are 4 cards each with 2 power ports, I swapped known good power cables into what should be Chain#1.  I also swapped the serial cable with no effect.   I'm beginning to think it's the hardware which failed.  My friend purchased this and left it with me, so hopefully he did not receive a dud.


text:
Imported Multibit HD wallet into electrum - Bitcoins are gone!
I got locked out of my multibit HD wallet and couldn't restore it with the seed phrase (even though it said they're valid) so I installed electrum and used the seed words to import the wallet. It worked but the bitcoins have disappeared. Is there a way I can recover them?

Do the addresses that you have look like your addresses? It is likely that you are using the wrong derivation path as Multibit HD and Electrum use different default derivation paths.

If you cannot see the history, calm down, it's just some keypath issue, you'll find a way to fix it.

Try restoring again. To do that you have to create a new wallet file via file > new/restore, enter a unique filename and click next. Then be mindful of the following things:

On the seed entry step click on options and check bip39. Pay attention to the message next to the options button in this step. When it says bip39 checksum OK you can proceed to the next step.
In the next step enter a derivation path of m/0' . That’s a zero and a single quote.


text:
Where is the data stored in Bitcoin?
Is all the data related with the transaction of bitcoin stored in blockchain or the data stored somewhere in the cloud and they are referenced from blockchain. I have this confusion because if we are storing all the transaction information on blockchain then it will become heavy with time. How it will get managed at storage level (if the data is in blocks).
The size of each block in bitcoin is 1 MB, is it sufficient to store all the data (of every 10 mins) in the blocks?

Yes, all data related with transactions is stored on the blockchain.
The second part of the question was, is it sufficient?
At 1 MB per block, and 6 blocks per hour, we get:

6 x 24 hours x 365 days = ~52 GB / year

Using a site with bitcoin statistics, we can check this (beginning of):

2018 = ~150 GB
2019 = ~200 GB
2020 = ~255 GB

Today the Bitcoin blockchain is ~275 GB in size.
So, yes, it is sufficient.

It should be ~52 GB, all the numbers you've posted should be in GB.

Fixed. Thanks for the heads up.

The blockchain (at least as far as Bitcoin goes) is a series of transactions, collected in blocks.
This data is stored on each and every full node (pruning aside). There is no cloud based storage as part of the bitcoin network, although third parties host various forms of parsed data in the form of explorers and other such products, some of which may use cloud storage (assuming by "cloud" you are referring to AWS/GCP/similar offerings).
The bitcoin network itself is self sufficient and requires no third party resources. When a new node joins the network, it simply downloads the historical data from other, existing nodes. There is no need for any other form of storage.

To expand a little on Raghav Sood's answer, Bitcoin miners and many wallets are what is known as full-nodes, they keep a complete copy of the blockchain.
However in the original whitepaper by Satoshi Nakamoto, from which Bitcoin came into existence, Nakamoto identified two ways to reduce the amount of data stored by a node

"Reclaiming Disk Space" (Pruning)

Once the latest transaction in a coin is buried under enough blocks, the spent transactions before
  it can be discarded to save disk space.

"Simplified Payment verification" (Lightweight wallets)

It is possible to verify payments without running a full network node. A user only needs to keep
  a copy of the block headers of the longest proof-of-work chain, which he can get by querying
  network nodes until he's convinced he has the longest chain, and obtain the Merkle branch
  linking the transaction to the block it's timestamped in

Nakamoto felt that Moore's law and other effects would mean that storage would not become a problem for a very long time.

There is no need to rely on a trusted third-party (cloud or otherwise) to store data.
Wallets also store data locally that is not present in the blockchain. For example: private-keys, indexes, notes attached to transactions etc.

For each device the user saves the blockchainas long string . If there are transactioncs , there are broadcast mechanism to update the blockchain


text:
Blockchain.com passphrase pattern ?
is there any way to know blockchain.com passphrase pattern , I mean they use some words from the dictionary to give someone a passphrase , how would we know the exact wordslist they use ?

Current blockchain.info wallets use the BIP39 wordlist, which you can find for various languages at https://github.com/bitcoin/bips/blob/master/bip-0039/bip-0039-wordlists.md/
Previous versions have used non-standard implementations with a variety of different wordlists for example v2 and v3.

is there any type of salt they uses at the time of making keypair ? or they just use 12 words passphrase to make the keypair ?

Current implementations follow BIP39 and 32, you can read those to see how keys are derived from the words


text:
How to know btc wallet name/website ?
Is there any way to know bitcoins wallet name using these details
pubkey publicaddress rsz signatures sha-256 ripemd160 script signature ( asm & hex )

if yes then please tell me how , and I just found a website which can tell the website/wallet name using public address " bitcoinwhoswho " but when I pasted publicaddress on that website it says " Wallet Name : 1237a80b42d675d2 " what does this means ?

None of the values mentioned are linkable in any way to the software that generated the address. Bitcoin Addresses are standardized, and all wallets follow identical rules for generating them.
Your only option to determine which software an address originated from is to have some backup of the wallet file, or some other indicator, such as an email confirmation.

then what does this means Wallet Name : 1237a80b42d675d2

That is likely just some internal accounting mechanism used by whichever site gave you that. It has no blockchain-level relation to that address


text:
On a shared wallet, if one of the recipients deleted their wallets off their phone, is there a way to rejoin?
We only had one 12 word backup for the main holder on their phone. The second person, on their phone didn’t get one(me). That I know of, I guess. But I deleted the wallet by accident. Now, is there a way to get back in there as I am the second co-signer and kind of need to have access to the wallet. The first person is trying to send me wallet invites, etc, but I really don’t get it. It’s not working nor do I have the knowledge of this app. I just know for sure he had set it up so both of us needed to agree to use it or spend it. Now, I don’t even have access to the wallet and we can’t figure out how to get that back. Are we out of luck?

What wallet software are you using? If you have deleted the private keys (which is likely to happen if you uninstall an app), you will not be able to access any Bitcoin associated with those private keys.

Any money sent to a 2-of-2 multisignature address will be forever inacessible if one of the private keys is deleted (e.g. by uninstalling the phone app that holds them) and no backup was made and no recovery phrase was recorded.
There's a common aphorism that circulates in the bitcoin world in various forms, sometimes described as Bitcoin Rule 0

No private keys -- no Bitcoin
Not your private keys -- not your Bitcoin

The latter refers to web-wallets where the wallet-provider business holds the private-keys and their customers do not, or where an online "friend" creates a watch-only wallet for you. The first form of the aphorism is apt here.

One fifth of Bitcoin is permanently lost


text:
Is bitcoin bonus and cloud mining real?
I received an email saying I have so much money from a cloud mining app that I set up using my phone and the app connected with my IP address.. I didn't really pay to much attention to  the app so I just set the account up and left it like that but where the app was connected to my phones IP address it has been cloud mining for 364 days and I have gained 1.31 in bitcoins and I needed to withdraw it soon but I'm not sure how to do that.. So I been on there messing with it and some how my funds has been sent to SWIFT, what is SWIFT can someone please let me know asap.. Thank you for your time and support

I got the same thing oi nice you have a Bitcoin account you deposit money you buy bit coin the y oi u just pay theme then the will say they can't sent all you money once beacouse is too much money they asked you again to pay another fee you pay then they waited a little they tell you for not pay taxes in you Bitcoin you have to rent an account it like 96$ a day then they disappear they don't talk to you any more and just got scammed by f 100$ I hope my God is going ng take care all of them some how karma is a bitch


text:
What does the electrum wallet file contains?
I have been using electrum wallet and I heard that there exist a wallet file... but what does exactly contains? the private keys?

I heard that there exist a wallet file

According to https://electrum.readthedocs.io/en/latest/faq.html#where-is-my-wallet-file-located

The default wallet file is called default_wallet, which is created when you first run the application and is located in the /wallets folder, inside the datadir.

what does exactly contains? the private keys?

It contains at least the seed and private keys

How is the wallet encrypted?
Electrum uses two separate levels of encryption:
Your seed and private keys are encrypted using AES-256-CBC. The private keys are decrypted only briefly, when you need to sign a
transaction; for this you need to enter your password. This is done in
order to minimize the amount of time during which sensitive
information is unencrypted in your computer’s memory.
In addition, your wallet file may be encrypted on disk. Note that the wallet information will remain unencrypted in the memory of
your computer for the duration of your session. If a wallet is
encrypted, then its password will be required in order to open it.
Note that the password will not be kept in memory; Electrum does not
need it in order to save the wallet on disk, because it uses
asymmetric encryption (ECIES).
Wallet file encryption is activated by default since version 2.8. It
is intended to protect your privacy, but also to prevent you from
requesting bitcoins on a wallet that you do not control.

From what I have read, from version 2 the Electrum wallet file is in JSON format - so should be readable with a text editor / viewer.
If you see nothing other than unreadable base64 text (A–Z , a–z , 0–9 , + , / and =), it means the wallet is encrypted.


text:
Taproot Script Path - Multisig Invalid Schnorr Signature
I am trying to implement a script-path spend on taproot, where the 1 script is a 1 of 2 multisig (yes I know this isn't the most efficient way of achieving this outcome).
I can get the key-path to work correctly, and I have calculated all of the tagged hashes correctly, but I still get error code: -26 error message: non-mandatory-script-verify-flag (Invalid Schnorr signature).
My Schnorr signature is correct and is validated, and corresponds to one of the keys in the multisig (when I try the other key I get same error). I suspect the problem lies in either the multisig script implementation, or the sighash construction.
My multisig is as follows: <32-byte pubkey1> OP_CHECKSIG <32-byte pubkey2> OP_CHECKSIGADD 1 OP_NUMEQUAL, a.k.a <20> <32 bytes> <ac> <20> <32 bytes> <ba> <51> <9c>
My sighash is the following (with little endianness where appropriate):
epoch + hash_type + version + nlocktime + #sha_prevouts + #sha_amounts +#sha_scriptpubkeys + #sha_sequences+ #sha_outputs + spend_type + input_index
Where epoch = "00", hash_type = "00", spend_type = "00" and input_index = "00000000".
I am formatting and concatenating the SHA preimages correctly (including the script byte lengths), and this sighash format has worked for key path spends in the past. Everything hashes out correctly (there is no witness program hash mismatch).
My control block is: c0 + internal_pubkey and unlocking script is: "00" + "40" + schnorr_sig + <len script> + <script> + <len control block> + control_block. I wasn't sure if the "00" should go before or after the first sig, but with script execution it makes sense to put "00" first in case where I sign with first pubkey (although I've tried both ways unsuccessfully).
Given my validated signature (which does match to the 1 of 2 multisig), seemingly correct sighash etc., I'm at a loss of what I could be doing wrong. Any assistance is greatly appreciated. Below is the sighash, TapSighash, signature and final raw transaction respectively:
Sighash:
0000010000000000000099f39068ebcfd1d34e63d3bd1159c8237d5d086343c06408cdbc79180695e8c73e1f6dbf626619317d04b24ac25799871709e0f3e35cc0e05dae4da21bc5a162e3c29eaa90352e63931c83366d585cc64019da58c9cd8dd2f43062702153d6b9bf906cd362964d265fdb27547a75d2ad2ce86cccec49cdc613764a77dc5f149d993b3cce8dcc00523357f17a52fcc5fecbe39fea83829dda4bdf453fb3d056300000000000
TapSighash:
0aea7f6f399744d65b9b8077c2f1431b14a78db43bd9659f6c1afd65a912dfdc
Schnorr Sig:
ef6ee4c4ec327c61b3455575f4683df36b24b993daccca3328473e1149906f1f929c2707f5f972855935f2b9320538e6999e4bd1b0ad99f86332100a190164e5
Raw Tx:
01000000000101c9612f1a4436eae322feecf68ef3318f87c3ce375c09b1d257c7621e5997f5df0000000000fffffffe0218150000000000002251203ea692bfe06ac9956836045a73b0184644c9d8cdd39734236c4c101c59676ce658020000000000001976a9148059905a03a8b65b9783037490d629948898054888ac040040ef6ee4c4ec327c61b3455575f4683df36b24b993daccca3328473e1149906f1f929c2707f5f972855935f2b9320538e6999e4bd1b0ad99f86332100a190164e54620de153317307164e7c9918791c7787d9833a3a8201bdff880e631e490cf9a087cac202e936665ba37c601f91a8110d9da29caeb20b4f62c55ef3ae7868bd7a37afa84ba519c21c0b33421b257ea992bc721b71b58449ac6e529318daff80a4b7477abddf829476400000000

The sighash computation is different for key path and script path spends. Is this what you're missing?

@PieterWuille Yes that would be it. Where can I find the sighash computation specification for script path spends? I don't see in the BIPs.

The sighash for BIP342 script path spends is different from that of BIP341 key path spends.
From https://github.com/bitcoin/bips/blob/master/bip-0342.mediawiki#signature-validation:

If the sig is 64 bytes long, return Verify(p, hashTapSighash(0x00 || SigMsg(0x00, 1) || ext), sig), where Verify is defined in BIP340.

Note the ext_flag passed to SigMsg is 1 (unlike the 0 in the case of key path spends), and also note the ext appended to it, defined in the section above.


text:
Is there a scientific survey on the number of Cryptocurrency fails / scams?
Is there a scientific survey/ publication/ paper about how many of the 1597 cryptocurrencies/ blockchains listed by coinmarketcap.com or similar, might be scam, have failed or are not even developed?
I wonder how many of those hundreds of blockchains around might be serious projects.
Blog entries or estimations might also be useful to me, but I would like reliable information.

Bitcoin.com

Having completed an extensive study into last year’s crowdsales, news.Bitcoin.com can report that 46% of them are effectively dead already – despite raising over $104 million.

Satis Group's Cryptocurrency Research

On the basis of the above classification, we found that approximately 81% of ICO’s were Scams, ~6% Failed, ~5% had Gone Dead, and ~8% went on to trade on a exchange.

Lastly, Bitcoin.com also mentions that in an MIT-authored research paper, Initial Coin Offerings and the Value of Crypto Tokens, it was "found [that] only between 5% to 25% of ICOs are frauds." However, I couldn't find evidence of this claim in the paper mentioned.

Thank you, that are many sources, which I can totally use!

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


text:
What is/are the first proposal(s) of blockchain or alternatives?
I am writing a thesis about blockchain and part of my writing is the history of blockchain, so far I found the first proposal was “How to Time-Stamp a Digital Document” in 1991 by Haber and Stornetta. Source: https://www.quora.com/What-is-the-history-of-blockchain-technology
The second proposal was by the unknown Satoshi Nakamoto, “Bitcoin: A Peer-to-Peer Electronic Cash System”.
So my question is there any other proposals before the Bitcoin implementation of blockchain?

I have an article here that covers some of the precursors. The Princeton Bitcoin Book also goes into some more details.

In addition to "How to Time-Stamp a Digital Document", in 1992, Bayer, Haber and Stornetta incorporated Merkle trees to the design, which improved its efficiency by allowing several documents to be collected into one block in a book "Improving the Efficiency and Reliability of Digital Time-Stamping"

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


text:
How can I -abort ./bitcoind -reindex-chainstate?
I made files re-accessible. Now we could return to a later, already synchronized state with the files. I tried to put ./bitcoind -reindex-chainstate=0, also in a bitcoin.conf, also directly calling the conf. It goes on reindexing the chainstate.

-reindex-chainstate is an instant operation: it wipes a the chainstate (UTXO) database. It is performed at startup whenever the -reindex-chainstate command-line option, or the reindex-chainstate=1 config file parameter is provided. It cannot be interrupted, but it is so fast this is rarely a concern. It's equivalent to emptying the chainstate/ directory by hand, FWIW.
Whenever the chainstate is behind the blockchain (i.e., you have blocks in your blocks/ directory which haven't been processed yet), the missing blocks will automatically be processed. This will typically happen after a -reindex or -reindex-chainstate, but it can happen outside of those too. E.g. when you wipe the chainstate/ directory yourself, or maybe if restore it to an older backup without making the equivalent restoration of the blocks/ directory.
The naming of these options is somewhat confusing, because what they trigger isn't the actual reindexing, but just the wiping that preceeds it; the reindex is automatic, and progressive (it will continue where it left off if you shutdown and start again, unless you specify the reindex option again at startup; in that case, it is wiped again and you'll start over again).
FWIW, any option, including these, can be disabled using the "no" variant (-noreindex-chainstate here) or passing 0 (-reindex-chainstate=0). But, as explained, that just disables the wiping; it cannot undo a wipe, and thus cannot "abort" the reindexing, as Bitcoin Core cannot proceed without first processing all the blocks it has.

In -help, -reindex-chainstate doesn't advertise to be an assignable [string typed] argument.
This means it is a boolean argument.
Don't assign it zero. Remove it completely.
Cheers!

Non assignable argument, boolean:
  -reindex-chainstate
       Rebuild chain state from the currently indexed blocks. When in pruning
       mode or if blocks on disk might be corrupted, use full -reindex
       instead.

Assignable argument, type string, not boolean:
  -settings=<file>
       Specify path to dynamic settings data file. Can be disabled with
       -nosettings. File is written at runtime and not meant to be
       edited by users (use bitcoin.conf instead for custom settings).
       Relative paths will be prefixed by datadir location. (default:
       settings.json)

removing lets it go on reindexing

let it reindex completely, then command it to close normally, let it finish normally; then try again and it shouldn't reindex

It does. Even after switching to ´-reindex´ and ´bitcoin-cli stop´.

It's impossible to abort reindexing, because it is an instant operation. Passing -reindex or -reindex-chainstate wipes certain parts of the database, at startup. The actual reindexing is what follows: the process of rebuilding the databases. Bitcoind cannot operate without those databases.

seems to be right description according to src/init.cpp "// This is a no-op if we cleared the coinsviewdb with -reindex or -reindex-chainstate". Post it as a main answer?
Dbs are supposed to be edited finely record by record, and this measure would have been of help.

This answer is also factually wrong; see my own answer.

@PieterWuille I just read, there is missing detail here, but I see nothing wrong.

You're saying that setting it to zero doesn't work; that's false. -reindex-chainstate=0 is exactly the same as not setting it at all, and is the opposite from -reindex-chainstate or -reindex-chainstate=1.

Yeah, it is a boolean argument. If it is assignable is only because Bitcoin accidentally wrongly made boolean arguments assignable.


text:
bitcoincore with linux (tgz) or arm linux
I am running a node on a raspberry pi 4 model B 8gb with linux as os, should I update bitcoincore with linux (tgz) or arm linux.

Cross posted from https://github.com/bitcoin/bitcoin/issues/23278.

The "Linux" binaries listed on bitcoincore.org and other download sites are for x86 (32-bit) and x86_64 (64-bit) architectures.
Raspberry Pi is an ARM-based architecture, so you need the ARM binary (32-bit if you have a 32-bit OS, 64-bit if you have a 64-bit OS; both are commonly used on Raspberry Pi).


text:
How to send bitcon with zero fee?
When I try use electrum or other wallets I have error: the transaction was rejected by network rules.\n\n66: min relay fee not met
How to send bitcon with zero fee?

It's not possible.


text:
What are the common cases of disputes where buyer is found guilty in cryptocurrency trade?
I am working on dispute management of crytocurrency trade and I am new in this field.
I want to know what are the cases where a buyer is found guilty in a cryptocurrency trade whether it is on localbitcoin.com or anywhere else.
It will be a good help for me.

The best thing to do would be to consult a lawyer so you can understand the law, your rights, and only engage in behavior you feel meets the level of risk you're willing to assume.


text:
Bitcoinj wallet can't receive coins in Testnet3
I have a problem with bitcoinj.
I have created a wallet and than trying to send coins to it in Testnet3 using this faucet:
https://coinfaucet.eu/en/btc-testnet/
Coins sended, transaction confirmed, but when I trying to get balance - it's always zero (available = available spendable = extimated = estimated spandable = 0).
Here is how I creating a Wallet:
NetworkParameters params = TestNet3Params.get();
Wallet wallet = new Wallet(params);
BlockChain chain = new BlockChain(params, wallet, new MemoryBlockStore(params));
PeerGroup peerGroup = new PeerGroup(params, chain);
peerGroup.addWallet(wallet);
peerGroup.startAsync();
File file = new File("testwallet");
wallet.saveToFile(file);

Address:
wallet.currentReceiveAddress().toString()

Balance:
wallet.getBalance()
wallet.getBalance(Wallet.BalanceType.AVAILABLE_SPENDABLE)
wallet.getBalance(Wallet.BalanceType.AVAILABLE)
wallet.getBalance(Wallet.BalanceType.ESTIMATED_SPENDABLE)
wallet.getBalance(Wallet.BalanceType.ESTIMATED)

And it's always zero.
What I'm doing wrong? Why I can't receive coins?

Use WalletAppKit this class is Utility class that wraps the boilerplate needed to set up a new SPV bitcoinj app. Instantiate it with a directory and file prefix, optionally configure a few things, then use startAsync and optionally awaitRunning.
i created the wallet and send the coins using your the faucet you have mentioned and its works fine and receiving coin, here is my code...
public class Main {
    static NetworkParameters params = NetworkParameters.testNet3();
    static String path = System.getProperty("user.home") + "/Desktop";
    private static File walletFile = new File(path);
    private final static String APP_NAME = "MyWallet";
    private static WalletAppKit kit;

    public static void main(String...args)
    {
        kit = new WalletAppKit(params, walletFile, APP_NAME)
        {
            @Override
            protected Wallet createWallet() {
                Wallet wallet = new Wallet(params);
                return wallet;
            }
            @Override
            protected void onSetupCompleted() {
                super.onSetupCompleted();
                System.out.println(kit.wallet().currentReceiveAddress());
                System.out.println(kit.wallet().getTotalReceived().toFriendlyString());
                txHistory();
            }
        };
        System.out.println("start syncing...");
        kit.startAsync();
        kit.awaitRunning();
    }

    private static void txHistory()
    {
        List<Transaction> txx = kit.wallet().getTransactionsByTime();
        if (!txx.isEmpty())
        {
            int i = 1;
            for (Transaction tx : txx)
            {
                System.out.println(i + "  ________________________");
                System.out.println("Date and Time: " + tx.getUpdateTime().toString());
                System.out.println("From Address: " + tx.getOutput(1).getAddressFromP2PKHScript(params));
                System.out.println("To Address: " + tx.getOutput(0).getAddressFromP2PKHScript(params));
                System.out.println("Amount Sent to me: " + tx.getValueSentToMe(kit.wallet()).toFriendlyString());
                System.out.println("Amount Sent from me: " + tx.getValueSentFromMe(kit.wallet()).toFriendlyString());
                long fee = (tx.getInputSum().getValue() > 0 ? tx.getInputSum().getValue() - tx.getOutputSum().getValue() : 0);
                System.out.println("Fee: " + Coin.valueOf(fee).toFriendlyString());
                System.out.println("Transaction Depth: " + tx.getConfidence().getDepthInBlocks());
                System.out.println("Transaction Blocks: " + tx.getConfidence().toString());
                System.out.println("Tx Hex: " + tx.getHashAsString());
                i++;
            }
        }
        else
        {

            System.err.println("No Transaction Found");
        }
    }
}


text:
CoPay Limits per day
Does anyone know if there are limits to the amount of BTC that can be moved in and out of a Copay Multi sig wallet please either on a daily basis or in total or both ?

There are no limits set by the wallet itself. As long as the co-signers agree you can do what you like.

Ok thank you. Appreciate your answer...and in terms of support in the event of a problem...Is the support on the Github site ?

It's open source software so support will be community support only. There are many community forums like bitcointalk.org and subreddits /r/bitcoin and /r/bitcoinbeginners. Note there are other open source wallets as well. You can compare them here.

Note that Bitpay, the maintainer, is essentially not maintaining this software. It is terribly out of date and vulnerable at this point. There is very good reason not to use it.

Thanks Eponymous....are there other simple elegant alternative Multi Sig wallets you would suggest please ?

@eponymous why do you say that? last release was a week ago.

@Abdussamad  Their own demo instance and backend is still using Bitcoin Core 0.12, which is incredibly obsolete at this point. https://insight.bitpay.com/api/status?q=getInfo

There's been effectively no development of the software to speak of for years, other than adding support for bcash and hard linking it into the software.


text:
One more question about scripting

Is it possible to write a script that would allow withdrawal of money only to a specific address?
Is it possible to write a script that would allow withdrawal only specific amount?

Any examples ? Thanks!

Bitcoin script has no way to get information about the outputs of a transaction spending it, so no, neither of those things are possible. If you want withdrawal only to a specific address, why not just send to that address the desired amount in the first place and save yourself a transaction fee?


text:
Lightning Network: what about tx fragmentation?
I really have no idea how to aks it right. Let me give an example:
We have a some peoples A,B,C,D.... And A makes transaction to B, then A need to pay to C, then send some coins to D, etc... After closing channel A must pay fee like in onchain transaction. So there is no reason to use lightning when A need to pay some coins to different recepients?
I hear lightning can do decentralized exchange. Can someone give an example how it will work with less fees (or zero fee if it possible)?
Another example: if A trade BTC with B,C,D,E.... And A got +0.01BTC for each trade, then B need to pay 0.01 BTC, C pay 0.01BTC..... There is a lot onchain inputs, so a lot of fees (after channel close)
Sorry for my English

A must pay fee like in onchain transaction. So there is no reason to use lightning when A need to pay some coins to different recepients?

Yes, when opening or closing a channel, on-chain transactions occur and thus fees must be paid. However, the interesting thing about the lightning network (LN) is that those two on-chain transactions can now account for a whole bunch of transactions to anyone else connected to the LN. Even further, the closing of a channel can also be the opening of a new channel, so this reduces the onchain payments to ~just one per channel. So rather than having one on-chain fee per transaction, you can pay one on-chain fee for potentially a huge number of transactions.

I hear lightning can do decentralized exchange. Can someone give an example how it will work with less fees (or zero fee if it possible)?

An exchange service could be built on top of the LN. Such a service could allow users to atomically swap coins that exist in a payment channel, without a custodial service involved. The exchange service simply plays 'matchmaker' for buyers and sellers. A quick google search shows me this service, called SparkSwap, as an example (disclaimer: I have never used SparkSwap, and have no affiliation with them, I literally just found them in a google search and their service seems like a relevant example)
Note that a LN exchange is best suited for trading between LN network and on-chain BTC, or between different cryptocurrencies. Not BTC <-> Fiat $$.

Another example: if A trade BTC with B,C,D,E.... And A got +0.01BTC for each trade, then B need to pay 0.01 BTC, C pay 0.01BTC..... There is a lot onchain inputs, so a lot of fees (after channel close)

I'm not sure exactly what you mean here, but in general: receiving or sending payments on the LN will not lead to more fees when closing your LN channel. You can open a channel and then send 1 transaction, or send/receive 1000 transactions (within the channel capacity), and the channel closing fee will be the same.


text:
What is the maths behind Bitcoin?
I am a math enthusiast. I am now feeling strong interest in bitcoin technology and key research areas. I would like to know what mathematics sub areas are required for bitcoin technology. I am more interested to the application side of bitcoin. For example corporate governance.

I don't see what corporate governance has to do with a currency.

I mean actually the decentralized autonomous organization (DAO)

You may have better luck on https://ethereum.stackexchange.com; there are no DAOs on Bitcoin.

SHA-256, RIPEMD-160, ECDSA, SECP256K1, PBKDF2, HMAC-SHA512, BASE58, Blockchain, Proof of Work, Linked List, Hash Table, and Hash Set are some keywords you can research.

@Brandon. Thanks ! You mean that  data structures and cryptography are the main focus?

@denim, yes, after you are comfortable with the primitives you can move on to layer 2 solutions such as the Lighting Network which will require you to know about Payment Channels, Watch Towers, Onion Routing, and Pickhardt Payments.  You will also want to know how BIP32 and BIP39 are used to grow a wallet from a seed.  Schnorr and SegWit are also very important concepts to understand.  An easy way to get a tour of every topic mentioned is to just watch Andreas Antonopoulos videos.  But you will have to work out some math problems too.

@Brandon, I see some of the videos of Antonopoulos about bitcoin. However i find most of the lectures are on abstract talks without deep technical details. Therefore i am looking to find some resources for the understanding of Bitcoin technologies ( e.g data structures, networks, payments etc. ) from the computer science engineering point of view. Could you please suggest some of the resources such as lecture notes and textbooks for this purpose? Thanks in advance !

@denim, "Mastering Bitcoin" and "Mastering the Lighting Network" Andreas Antonopoulos is likely what you are after.  The are both open source and free on github.  https://www.youtube.com/c/RenePickhardt is another great resource if you want to listen to lectures by a Bitcoin developer.  Another good way to find lectures is to filter a YouTube search by videos longer than 20 minutes.  Reading old posts from https://bitcointalk.org/ should get you the rest of the way.  You need to know game theory, computer science, and crypto primitives for it all to make sense.

@Brandon, Thanks again ! I understand as you mention that cryptography and Game theory are essentials. In computer science do you mean Computer networks and operating systems along with Data structures and algorithms?

Well computer science is the study of algorithms and data structures. Bitcoin requires a network to operate, not necessarily the Internet, but some mechanism of transferring data between nodes, otherwise its centralized.  If you are talking about data transfer you could read about blockstream satellites, SSL, TCP/IP, onion routing, bit torrent protocol, and BTC over HAM radio. Alternatively, the byzantine generals problem, feedback loops (markov chains applied to game theory), network effects (such as the electrical grid, internet, email, or cell phone service) deal with graph theory networks.