text:
How to use remote bitcoind with docker
I want to use multiple nodes with the same remote bitcoind. E.g. my node on my desktop, my node on digital ocean, my node on Google cloud ...
I don't want to run everywhere a full bitcoind and pay for the disk space.
I currently check the option to use btcpayserver (docker) on Google cloud as well. Again, it would need bitcoind.
Any hints welcome.

c-lightning internally calls bitcoin-cli and will pass a couple of commandline arguments to it. These arguments are all prefixed with --bitcoin-* and will match the ones that bitcoin-cli accepts.
So for your use-case you first need to make sure that bitcoin-cli is available on the machine that you will be running the c-lightning instances on. If it isn't you can simply use the Bitcoin PPA to install (but not run) bitcoind which will also install bitcoin-cli (assuming you're using a debian based OS):
sudo add-apt-repository ppa:bitcoin/bitcoin
sudo apt-get update

For a remote bitcoind you need to specify the following arguments:

--bitcoin-rpcconnect=<bitcoind-ip:port> this tells bitcoin-cli to connect to a remote bitcoind instance instead of trying localhost:8332 (make sure bitcoind is configured with -rpcallowip=<ip>, where <ip> is the machine you'll be running c-lightning on)
--bitcoin-rpcuser=<username> the username configured with bitcoind
--bitcoin-rpcpassword=<password> the password configured with bitcoind

In any case I'd suggest running bitcoin-cli --bitcoin-rpcconnect=<bitcoind-ip:port> --bitcoin-rpcuser=<username> --bitcoin-rpcpassword=<password> from the command line on the c-lightning machine to verify that bitcoind and bitcoin-cli are configured correctly.


text:
How to upgrade docker clightning
I tried to update clightning to the new version of 0.7 by

docker-compose stop
docker-compose rm clightning_bitcoin
docker-compose up

However, it is still version 0.63
Where do I set that it is upgrading to 0.7?
Would this change in docker-compose.yml be correct?
  clightning_bitcoin:
    image: elementsproject/lightningd

to
  clightning_bitcoin:
    image: elementsproject/lightningd:latest

I don't use docker but maybe the people from clightning forgot to update the docker build. I would cross post that question in their issue tracker

Yep, that's it, we didn't get around to update the images right away :-)

source: Stack Exchange

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

sort: votes


text:
How to debug lightning-cli invoice
I tried:
lightning-cli invoice 100 invoice20190126 payme

and nothing happens. How to debug?

I have copy and pasted the command to my c-lighting node and it works producing the following output:
lightning-cli invoice 100 invoice20190126 payme
{
  "payment_hash": "af2a2e0a6f4924f755e296c219ade5f2c65616fcec5bb8e62b253b8a71a442cb",
  "expires_at": 1548528927,
  "bolt11": "lnbc1n1pwye8cdpp54u4zuzn0fyj0w40zjmppnt097tr9v9hua3dm3e3ty5ac5udygt9sdqgwpshjmt9cqp2rzjqgj8m8dsm7h75az7lry7zc0txghh8tpl3pvdsuctdlvhy4r50nnkkzrgpvqqf0cqqqqqqq05qqqqraqqjq9c06msw62wushzceav74p2zzmznmtud4c3hkw6keqvquxnm6kaxry4rm7aerwppl4jn5xm7tyjxvvyyve5w06slwm7fvxfspx363j9cqcevtr7"
}

Which version of c-lightning are you using?
Also there was recently a change of the JSON RPC API due to the new plugin system. Could it be that you have not updated lightning-cli but only lightningd?

I use docker-compose and don't see the version there. I have stopped, removed the container and rebuild clightning_bitcoin. Now it is working! Thanks! The respond is:
lightning-cli invoice 100 invoice20190126 payme
{
  "payment_hash": "374c59643514b917da44ba737f6dcdf59cf6708903e6403f9477022185c91c18",
  "expires_at": 1548530289,
  "bolt11": "lnbc1n1pwyefrppp5xax9jep4zju30kjyhfeh7mwd7kw0vuyfq0nyq0u5wupzrpwfrsvqdqgwpshjmt9cqp2rzjqwac3nxyg3f5mfa4ke9577c4u8kvkx8pqtdsusqdfww0aymk823x6zyyhgqqv0gqqyqqqqqqqqqqqqgqjqt96ykzgwc5qd9034mfw4khlypu4zx9qwdzjvsg4dpfrffdg9qvgnk2uey6h7f4g9663rvqaucnfn95j2taruezgdh3w6w3v2xauzvjqp47g2m5"
}

you can see the version with lightning-cli getinfo

I get for version: "version": "",

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


text:
how long can it take me to get 1 BTC on mining speed 30.9945H/s and 72.99451H/s respectively
im new to this biticoin mining, i justed to know is it going to earn me anything soon where my mining speed is at 30.9945165416H/s and 72.9945165416H/s really? how long can it take me to get 1 BTC
like for;
30.9945165416H/s how many days
72.9945165416H/s how many days

Do you really mean H/s? Not GH/s or TH/s?

how can i increase the speed using my computer to meet at least GH/s. what should be my average speed to make 1BTC atleast in a month and kindly note that im using Cryptotab browser to mine

@ChibubiJackson You can't. You're trying to mine bitcoins without a bitcoin miner. See my answer -- you have a completely inappropriate tool and are competing against people who have the right tools. You will never, ever win.

what startup hardware can i use and how much can it be?

like this one Bitmain Antminer S9i, and how many BTC can i mine in a month?

kindly advise which one of theses two can i buy
https://shop.bitmain.com/product/detail?pid=00020181217184315223R2qdxwHM06D0     or   https://shop.bitmain.com/promote/antminer_s15_asic_bitcoin_miner/overview

It would never, ever happen. The increase in difficulty and the reduction in mining reward would mean that you would never, ever accumulate anywhere near 1 BTC with a mining speed that low. You would need to be more than a billion times faster.
Mining is perfectly competitive. Trying to mine with hardware like that is like trying to win a race to build a suspension bridge across a massive river using teaspoons and toothpicks when other people have flat beds full of steel and steamshovels.
Update: "kindly advise which one of theses two can i buy ..."
Why? Why would you want to enter a business you don't understand? I don't understand tailoring, so I'm not going to go out and buy the stuff to have a tailoring business. Having a bitcoin mining business requires you to get everything right because it is absurdly competitive. Were you to just get an S9i and hook it up in your home, you'd lose $45/month. And that assumes you don't need additional air conditioning to get rid of the 1.3Kw of heat it generates.
Update: I just read their FAQ -- they're not mining bitcoins at all, "In fact, CryptoTab software is mining Monero(XMR) and then converts them to Bitcoins in accordance with the current exchange rate, that is why your balance is displayed in BTC.".
I re-did the math using Monero, and I got a best case yield of minus $6/month. The exact amount depends on your electricity cost. That assumes you personally keep 100% of your mining reward, which I'm pretty sure you don't since you're in someone's downline and are paying for conversion to BTC and whatnot.
It seems like an obviously bad idea though. What's the benefit of combining the mining program with a browser? What conceivable advantage does that have over a separate mining program? And there are obvious downsides -- if I want to change mining programs, mining pools, or which coins I'm mining, I have to change browsers!

how can i increase the speed using my computer to meet at least GH/s. what should be my average speed to make 1BTC atleast in a month and kindly note that im using Cryptotab browser to mine

You can't. You have a computer and are competing against people with bitcoin miners. You are competing with people who have equipment that is more than a billion times more efficient than what you have. That is utterly pointless.

whaat startup hardware can i use

@Chibubi You'll need to buy specialized Bitcoin mining hardware.

like this one Bitmain Antminer S9i, and how many BTC can i mine in a month

kindly advise which one of theses two can i buy
https://shop.bitmain.com/product/detail?pid=00020181217184315223R2qdxwHM06D0     or   https://shop.bitmain.com/promote/antminer_s15_asic_bitcoin_miner/overview

@ChibubiJackson See updates. Why are you trying to enter a business you know nothing about that is perfectly competitive? That just doesn't make any sense.

you keep slapping me in my face kikikiki whats wrong with you.jackson wanted to make money but your Apostolic kind of advice has just made his ass find a place down

okay i hear you, i need some quide to do. i was miss led by this new browser CRYPTO BROWSER https://get.cryptobrowser.site so thought i could get it work well with the hardware like you tried to put it. i dont know what i can do because in two days i haave only managed this
0.000001597194BTC

and yeah, it came to me brand new without fixed ideas like your tailoring concept kikiki

@ChibubiJackson You saw a business pitch involving getting your friends to get their friends onboard and you thought that sounded like a good idea?! Has there ever been an MLM scheme that wasn't a scam? Here's the obvious biggest red flag ever -- nowhere do they give you any clue what your earnings might be from ANY source other than getting other people to use the system. How can that work? Someone has to actually generate revenue for their to be anything to flow up from a downline, right?

@ChibubiJackson: The largest private Bitcoin mining company in the world recently started shutting down some of its Bitcoin mining farms. If they can't make a profit in the current market, you have to be much smarter than them to do so. You need very cheap electricity and a large investment in equipment that may only be economically viable for a short while. It isn't the sort of business you should go into without long detailed careful preparation and planning.


text:
why using `blockIndex` in bitcoin's code `unconfTxs`
I am reading the code of rpc's estimateSmartFee method , and I can't understand why using blockIndex in unconfTxs ?
estimateSmartFee loop unconfTxs to get feeRate(code: https://github.com/bitcoin/bitcoin/blob/0.18/src/policy/fees.cpp#L291)
But the value unconfTxs[blockIndex][bucketindex] will be reseted in TxConfirmStats::ClearCurrent or reduced in TxConfirmStats::removeTx.
Why not just define like this unconfTxs[bucketindex]?
source file fees.cpp
unsigned int TxConfirmStats::NewTx(unsigned int nBlockHeight, double val)
{
    unsigned int bucketindex = bucketMap.lower_bound(val)->second;
    unsigned int blockIndex = nBlockHeight % unconfTxs.size();
    unconfTxs[blockIndex][bucketindex]++;
    return bucketindex;
}

the unconfTxs
    // Mempool counts of outstanding transactions
    // For each bucket X, track the number of transactions in the mempool
    // that are unconfirmed for each possible confirmation value Y
    std::vector<std::vector<int> > unconfTxs;  //unconfTxs[Y][X]

That whole vector is to keep track of how many blocks have passed since a transaction entered the mempool and what feerate it is. So it allows the estimator to look up how many transactions have been in the mempool for Y blocks at a feerate of X. This allows it to see what feerate is probably needed in order for a transaction to be confirmed in Y blocks.
If you just had the number of transactions at each feerate, that only tells you the feerate distribution of unconfirmed transactions. This is not helpful for estimating how many blocks will pass before a transaction becomes included in a block.


text:
Does BTC return fee in a failed transaction?
From wiki 'The fee may be collected by the miner who includes the transaction in a block.' wiki
So I think it will return your fee , in a failed transaction.But I can't find any other article about it. Does it really return fee?

Yes, effectively.  It isn't really that it's "returned", but that the fee is never actually "collected" until the transaction is confirmed.
If your transaction isn't confirmed, then no money moves at all.  The entire amount, including the fee, remains available for your use in a future transaction, though you may have to wait a little while for it to expire from the memory pool of other nodes on the network, and depending on your wallet software, you may have to use some obscure commands to make it forget the original transaction.


text:
Get Address from pubkey scriptPubKey
Given that address is a "convenience" field, it makes sense that it is not provided by default in many transactions. However, it seems to be possible to extract address from hex. I am wondering if I can get this address from bitcoin client applications (e.g., bitcoin-qt), ideally via the REST API.
An example block I am looking at is the block with height 100:
{
    "hash": "000000007bc154e0fa7ea32218a72fe2c1bb9f86cf8c9ebf9a715ed27fdb229a",
    "confirmations": 715831,
    "height": 100,
    "version": 1,
    "versionHex": "00000001",
    "merkleroot": "2d05f0c9c3e1c226e63b5fac240137687544cf631cd616fd34fd188fc9020866",
    "time": 1231660825,
    "mediantime": 1231656204,
    "nonce": 1573057331,
    "bits": "1d00ffff",
    "difficulty": 1,
    "chainwork": "0000000000000000000000000000000000000000000000000000006500650065",
    "nTx": 1,
    "previousblockhash": "00000000cd9b12643e6854cb25939b39cd7a1ad0af31a9bd8b2efe67854b1995",
    "nextblockhash": "00000000b69bd8e4dc60580117617a466d5c76ada85fb7b87e9baea01f9d9984",
    "strippedsize": 215,
    "size": 215,
    "weight": 860,
    "tx": [
        {
            "txid": "2d05f0c9c3e1c226e63b5fac240137687544cf631cd616fd34fd188fc9020866",
            "hash": "2d05f0c9c3e1c226e63b5fac240137687544cf631cd616fd34fd188fc9020866",
            "version": 1,
            "size": 134,
            "vsize": 134,
            "weight": 536,
            "locktime": 0,
            "vin": [
                {
                    "coinbase": "04ffff001d014d",
                    "sequence": 4294967295
                }
            ],
            "vout": [
                {
                    "value": 50.00000000,
                    "n": 0,
                    "scriptPubKey": {
                        "asm": "04e70a02f5af48a1989bf630d92523c9d14c45c75f7d1b998e962bff6ff9995fc5bdb44f1793b37495d80324acba7c8f537caaf8432b8d47987313060cc82d8a93 OP_CHECKSIG",
                        "hex": "4104e70a02f5af48a1989bf630d92523c9d14c45c75f7d1b998e962bff6ff9995fc5bdb44f1793b37495d80324acba7c8f537caaf8432b8d47987313060cc82d8a93ac",
                        "type": "pubkey"
                    }
                }
            ],
            "hex": "01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff0704ffff001d014dffffffff0100f2052a01000000434104e70a02f5af48a1989bf630d92523c9d14c45c75f7d1b998e962bff6ff9995fc5bdb44f1793b37495d80324acba7c8f537caaf8432b8d47987313060cc82d8a93ac00000000"
        }
    ]
}

Not all scriptPubKeys correspond to an address. The address field is provided for those that do, and is omitted for those that don't. Your example contains a P2PK scriptPubKey which does not have a corresponding address.
Some blockchain explorers may extract the pubkey from a P2PK output and compute a corresponding address, but that is not technically correct. Such an address would result in a P2PKH scriptPubKey, not P2PK.

Am I correct in assuming that if address is not provided, it means the address cannot be "constructed" correctly?

@Hamed Yes. If address does not exist, the scriptPubKey has no corresponding address.

Thank you. Does this apply only to P2PK, or I can generalize it to P2SH, P2SHH, and P2WPKH?

You can generalize it to all scriptPubKeys. If the scriptPubKey has a corresponding address, then there will be an address present. Note that there is no address for this P2PK scriptPubKey because all P2PK scriptPubKeys do not have addresses. Likewise, all P2PKH scriptPubKeys have addresses.


text:
How does the wallet prioritise keypool addresses imported via importmulti?
I want to use importmulti to import 100 addresses from an xpub descriptor.
If I set keypool: true as one of the arguments the keys get added to the keypool.
How does the wallet prioritise which keys it generates when calling getnewaddress? Will it prioritise the imported addresses or do I have to request the imported address via the label argument in getnewaddress? What if I don't add a label argument to the importmulti command?

There is no guarantee of the order by the API. But its currently FIFO (first in first out).
If the order/remembering is important to you, consider using fundrawtransaction with a wallet where you have private keys disabled createwallet "name" true.
Just import pubkeys define the change output address in fundrawtransaction.


text:
Check which C-Lightning version I am running?
Ive downloaded and unpacked the new version 0.6 but is there anyway I can check through CLI commands which version i'm running to ensure the update worked?

Sure, just use:
$ lightning-cli --version
v0.6-127-gf8fa421

Notice that the first part (v0.6) shows the latest release this version is built on, followed by the number of patches applied on top (127) and then the git commit that was built (prefix g, commit f8fa421). This allows us to pinpoint exactly which commit you have built.


text:
Why is bitcoind removing keys from keypool?
I opened my laptop which always has bitcoind running and my log is going ballistic with messages like:
2020-11-05T12:41:57Z [FullyNoded-d703055f46595edcf8163916bd906f9563afc0903fbe74c2882a93c59359ca00] keypool index 38212 removed
Why? What is it doing? Removing keys I imported? I never asked it to do that :(
RPC commands are also unresponsive as it seems to be overwhelmed.
Bitcoin Core 0.20.1

Are these occurring in order (e.g. 38211 removed, then 38212 removed)? Did you retrieve a lot of addresses but only receive Bitcoin at one that came after a lot of addresses?

yes and yes. Im watching 99,999 addresses and in order to generate payment addresses I randomly generate an address from range 0...99999 for a customer to pay. Does this log output mean it is no longer going to watch for those addresses?

fwiw the keypool is not relevant for my use case, all that matters is that bitcoind is watching those addresses and that I can use deriveaddresses.

The keypool is ordered, not just a set of keys being watched. This allows for addresses to be given out in derivation order, as well as maintaining the gap limit. When an address is used, all keys that come before it will also be marked as used. This is done to ensure that already used addresses are not accidentally reused.
So when you give out and use a random address in the range, you end up having all of the previous keys in the range be marked as used.
Removing keys from the keypool is purely for giving addresses out to the user and to be able to generate further addresses. It does not effect the watching behavior; keys removed from the keypool will still be watched.
The reason that you see a performance hit is because removing from the keypool deletes a record from the database in addition to writing several scripst to the database. Furthermore, if the keypool size drops below the configured keypool size due to these removals, the keypool will be refilled which will involve additional database writes. These all acquire a lock on the wallet which prevents other threads from accessing the wallet, and writing all of this data (especially tens of thousands of keys) can take a long time.
To avoid this problem, I highly suggest giving out addresses in order, not randomly. Otherwise you may not want to add the keys to the keypool although that means that you will lose the keypool refilling to keep the range full.

Makes a lot of sense, thanks for the answer. I should definitely not be adding them to the keypool for this specific use case.

This is so helpful thanks for this answer


text:
Why did the core developers choose base64 for PSBT encoding?
Why does bitcoind use baase64 to encode PSBT's? Just out of curiosity.

Since PSBTs can be fairly large, I wanted to use an encoding that compressed better than hex and was already in use and implemented by many clients. Base64 was already in use by other clients as signed messages also uses Base64. It also works well with command line without escaping or quoting so it seemed like a good choice.


text:
Min relay fee not met for a 2.0 s/b transaction
Im getting an error when trying to broadcast a raw transaction with bitcoin core 22, min relay fee not met. My mempool has 5,000 + transactions and the fee rate is 2.0 s/b. I have not changed the settings in my bitcoin.conf, the node has 200+ days of uptime and plenty of 1s/b transactions sent without issue.
Any idea why I may be seeing this error?
Here is the request and response:
request: {"jsonrpc":"1.0","id":"B0FCBD68-507D-424A-8D64-0DAFB162FA4A","method":"testmempoolaccept","params":[["020000000001012b5f39712243b825a38e69aedf4430908b2ec84120770461210a5113348026390000000000010000000114860100000000001976a914faea8b58ab5462c30f3f7e87d21705fdb6ee274888ac0400483045022100d7fac5a5827ef7f211133d210f5b14c1ed90b74c3748ced2d36760e3d0ce00e60220482c1eef45eb1a45ef3079411c83f92ce5a35f54fa563f531abfc50c413c0a170147304402201c348708606a30bcf4758408619ab2b2f27926ce3053320ff060fe174e1766b402203a724a7af15c4a0ddbc01c6adaf6501eb1ccc0d92b9aba4d59109a945edb59f30147522102973be012e1850da8f730b8c656979079f234a233537100fe8183fca2b6a0359f210304e3f0b7c8abdb009a0ab24b34c8c0ed54682b20c8d79a75ede3c19ea1595d8852ae00000000"]]}
json: {
    error = "<null>";
    id = "B0FCBD68-507D-424A-8D64-0DAFB162FA4A";
    result =     (
                {
            allowed = 0;
            "reject-reason" = "min relay fee not met";
            txid = 83338e540f4bdabed919eeb99d82db5979b5c62c89b70e7e3a856912db0ecc75;
            wtxid = 81521e8f742331ff1a5029aaa97a1bd10801244058f329ce58ea593a13042ee4;
        }
    );
}

The feerate is definitely not 2 sat/vb. It's less than 1 sat/vb, hence min relay fee not met.
Your transaction has a vsize of 141 vbytes. The single input has a value of 100000 sats and the single output is 99860. That's a fee of 140 sat, which results in a feerate of less than 1 sat/vb.

A common reason for the fee estimate being short a satoshi is that the signature is assumed to always be low-R, but the signer doesn't do low-r grinding.

Thanks, I never would have figured that out. I am using bitcoin core for fee estimation but am doing my signing with Libwally, so this would potentially make sense.


text:
How to Curl into Bitcoin node with Swift?
I am running a full node which accepts incoming connections.
Here is my config file:
rpcuser=bitcoinrpc
rpcpassword=somePassword
server=1
rest=1
daemon=1

Here is my swift code to curl to the node:
let url = URL(string: "http://bitcoinrpc:somePassword@192.168.1.8:8333")
    var request = URLRequest(url: url!)
    request.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
    request.httpMethod = "GET"
    request.httpBody = "{\"jsonrpc\":\"1.0\",\"id\":\"curltext\",\"method\":\"getinfo\",\"params\":[]}".data(using: .utf8)

        let task = URLSession.shared.dataTask(with: request) { (data, response, error) -> Void in

            do {

                if error != nil {

                    print(error)

                } else {

                    if let urlContent = data {

                        do {

                            let jsonAddressResult = try JSONSerialization.jsonObject(with: urlContent, options: JSONSerialization.ReadingOptions.mutableLeaves) as! NSDictionary

                            print("jsonAddressResult = \(jsonAddressResult)")

                        } catch {

                        }
                    }
                }
            }
        }

    task.resume()

}

I am using port 8333 and the static IP I set is 192.168.1.8
I get the following error when executing the code:
2018-08-02 12:04:53.659293+0800 BitSense[5596:568091] Task <47A80E16-F0FE-4508-9C5D-3EFDD82B55FB>.<1> HTTP load failed (error code: -1005 [4:-4])
2018-08-02 12:04:53.660223+0800 BitSense[5596:568092] Task <47A80E16-F0FE-4508-9C5D-3EFDD82B55FB>.<1> finished with error - code: -1005
Optional(Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost." UserInfo={NSUnderlyingError=0x600000244650 {Error Domain=kCFErrorDomainCFNetwork Code=-1005 "(null)" UserInfo={NSErrorPeerAddressKey=<CFData 0x600000280460 [0x107f6ac80]>{length = 16, capacity = 16, bytes = 0x1002208dc0a801080000000000000000}, _kCFStreamErrorCodeKey=-4, _kCFStreamErrorDomainKey=4}}, NSErrorFailingURLStringKey=http://bitcoinrpc:5bKc4zYHX6qvB9HjKK89Ms2h@192.168.1.8:8333/, NSErrorFailingURLKey=http://bitcoinrpc:5bKc4zYHX6qvB9HjKK89Ms2h@192.168.1.8:8333/, _kCFStreamErrorDomainKey=4, _kCFStreamErrorCodeKey=-4, NSLocalizedDescription=The network connection was lost.})enter preformatted text here

8333 is the node connection port. Since you didn't change the RPC port in the config file, the port you should connect to is 8332.

Thank you! also for anyone having the same issue, I needed to change the request.httpMethod = "GET" to "POST" and the "getinfo" method to "getwalletinfo". :)

AND I needed to change rpcallowip in the config file to rpcallowip=0.0.0.0/0


text:
Are filters available for Blockchain.com APIs?
I'm trying to get the block details of Bitcoin using block height. The API provided on the "blockchain.com" website also dumps the huge transaction list along with the response. Is there a way to filter it at the server side? Or, are there any other services that give such APIs?

Try Blockcypher.com's Block hash endpoint
Here is a sample api call
Click here
It limits the transactions array to 1 element
Hope it helps you

Check out Hal Streams. You can filter it server-side before getting the data exposed via API.


text:
When using createrawtransaction, are the outputs ordered as they are presented within the request?
Let say, when I set second parameter of craterawtransaction call as below
[{"demoaddress1": 0.42}, {"demoaddress2": 1.00}]

Is it possible to occur that returned transaction's output is not ordered as same? like below
[{"demoaddress2": 1.00}, {"demoaddress1": 0.42}]

I found the answer on mailing list.
https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2018-October/016441.html

The createrawtransaction RPC will now accept an array or dictionary (kept for compatibility) for the outputs parameter. This means the order of transaction outputs can be specified by the client.

According to the description, it should be the same order.


text:
how to free up disk space after running bitcoind for the first time?
I am following Antonopoulos' Mastering Bitcoin.  I have installed Bitcoin core and ran bitcoind for the first time. Although the book said it will remind me to create a configuration file, it did not.  It rapidly used up the disk space (I am running it on VM Ubuntu) and I had to interrupt it.
I want to free up the used space and try again with configuration file, but I do not know what to do.

Find the data directory: https://bitcoin.stackexchange.com/a/11210
Create a file named "bitcoin.conf"
Add
    prune=550
to that file.
Restart Bitcoin Core.

I just did.  It did not seem to delete old blocks. Shall I manually delete some directories/files containing old blocks to start anew?

If you delete blocks manually, the database would be corrupted. Are you sure that it doesn't work? Could you please try adding random "asdasd" to bitcoin.conf to see if Bitcoin Core can see the conf file? If so, it'd crash. Otherwise, you might need to set "-datadir" option pointing to the directory with the conf file. BTW, make sure to calculate the size of the blocks directory, the number of files there might be misleading.

i added asdasd and I think it does not see the config file, because it said it closed the database because no space left on device


text:
Where can I find the transaction volume?
I want to find the trading volume to do some trend analysis.But I can't find

Trading or transaction volume? For the transaction volume just query for the TXID list for each block of interest from a Bitcoin server.

I am assuming you are asking for trading volume across exchanges.
Brave New Coin (BLX) provides a good API to get volume weighed average across major exchanges: https://bravenewcoin.com/data-and-charts/indices/blx
You can also see their chart with volume on Trading View (look for BLX ticker): https://www.tradingview.com/chart/?symbol=BNC:BLX


text:
Getting transactions from mempool to block
I have a question about getting transactions from mempool to be added to block. Imagine the situation where we have 500 transactions in mempool, when we decide that is enough to start adding them to the block? Also what if we sre in the middle of mining (so we have Merkles tree root already) and the new transaction is added to the mempool? The process of our mining in my node is starting again?

While mining is done by specialized hardware, transaction choosing and merkle root calculating is done by the node software. While the specialized hardware is mining, a node may (and will) update its mempool continuously, and will calculate a new merkle root every few seconds. The mining hardware will check for header-template updates often, (and this instantaneous process is done without needing a restart), and will continue mining. The interval of header updates is chosen by the pool, and one of the aims is not to do it too often, or it'll waste the bandwidth

I'm not sure that I understand, I thougt that merkle tree is taken to the block, so updating list of transactions will somehow start minning again? (Reset the nonce to zero)

Yes, they can reset the nonce.

So this will not complicate mining? I mean after reseting the nonce we are starting again so we are not as close to winning as we were before reseting the nonce (I guess)

No, reseting the nonce with a different block template is not repeating the same POW, as the header hash will be different with the same nonce. (Same nonce, but different merkle-root)

Increase or decreasing a nounce don't make you any closer or far from finding a block. Otherwise you would just go straight to the highest nounce. Any order you try nounces is good.

You can start to work in a block at any moment, you can even mine an empty block. If any new transaction arrives you rebuild the merkle tree and continue.

So there is a possibilty to choose how many transactions is ok to start minning? Will the adding new transaction to potential block reset the minning (reset the nonce to zero)?

One don't need to reset the nounce. One can choose any nounce in any order.

Producing the optimal block-template to mine is a NP-hard problem.
The optimal block-template includes the highest sat/byte(or weight) transactions to maximise the miner reward. Assuming this computation and propagation of the perfect block-template took no time, it would make sense to update the block-template for each new transaction accepted to the memo-pool, as this new transaction could potentially increase the block reward. In this hypothetical scenario, the mining hardware is continuously working (hashing) and continuously updating the block header for a better block reward.
However, since producing the optimal block-template is NP-hard, it takes significant time/cost to compute the optimal block-template from the mempool at any point in time:

Knapsack problem - maximise total fee value in block
Maximum independent vertex set - ensure no two tx spend the same output.

Both problems scale exponentially and are expensive. This cost could have been invested in more hash-rate.
Therefore, there is a trade-off between block optimisation and mining utilization.

Continuously optimising for a better block-template represents a cost in itself, which could be invested in more mining hash rate.
There exists a financial optimum, where suboptimal blocks-templates are mined, whilst mining equipment is fully utilised.
(One extreme could be mining empty blocks, maximising the number of hashes performed, whilst spending zero resources in block optimisation.)
In practice, simplified heuristics are used to update new block-templates cost-effectively as mining is being performed.


text:
Reward in case of fork
Hi I would like to ask you guys for some details about getting reward from minning block when there is a fork - two miners get different blocks at the same time. Both of these block will have the coinbase transaction. Does it means that both of users wallets will have information about this transaction? If yes what will happen when both users will quickly go to bitcoin's ATM and take fiat currency from this reward?

Does it means that both of users wallets will have information about this transaction?

Both miners will see their own coinbase outputs in their wallet software, yes. However, the two coinbase transactions will be separate.

If yes what will happen when both users will quickly go to bitcoin's ATM and take fiat currency from this reward?

They cannot do this. Coinbase outputs are immature, and unspendable, for 100 blocks. After 100 blocks, a fork should ideally be resolved already. If it is not resolved, then only the miner on the same side of the fork as the ATM operator will be able to access his coins, as the ATM will not be aware of the coins on the other side of the fork.

Thanks, so one more question, what will happen that we have this fork and in one block we send for example 10 BTC to someone else and this person will immediately go to the ATM (which will be in the same side as our destination address which right now get the money), pickup the money and after few block this chain will be depracated (there will be other longer chain?

@Konrad simply: the user will have the money, but the ATM operator will no longer have the BTC payment. This is why waiting for a few confirmations is highly recommended, especially for larger payments.

I don't understand, what does it mean that "the ATM operator will no longer have the BTC payment", so it will be possible to cash out money or not? :)


text:
Could not sign Transaction with SignRawTransactionWithKey through the RPC (RegTest)
I am able to sign following transaction with Complete=true result, but when trying to decode signed transaction, it returns error "TX decode failed" both from DecodeRawTransaction and SendRawTransaction RPC calls.
signed_Tx = "020000000103d3049e968d8b3e3e967aa90b45d3f64b5e2117ee9610b0c9d5a96081a24e3e000000004847304402201921a1acf601acb0f9e6297a55eeb853c2dd6cd246ea05f060eaa4d327d4124a02206e08e2c90b92113a64d6de1447f81bf19703f88bffeacc6d2cc4bf0e21ed8ac501ffffffff0200e1f5050000000017a9140796253e13d88cda530bf88b07eb1672952a3a7887608a0e24010000001976a914957b73da3bf34440ab2f78937a7a420835255a0988ac00000000"

[TestMethod()]
public async Task CreateRawTxTest()
{
    Dictionary<string, object> prevTx = new Dictionary<string, object>() {
                    { "txid","3e4ea28160a9d5c9b01096ee17215e4bf6d3450ba97a963e3e8b8d969e04d303"} ,
                    { "scriptPubKey", "21033ff1181726af279fb2328e9ae041d71f323a91483f76841fe23aa03f87ecf3d3ac" },
                    { "vout", 0} };

    List<object> txIn = new List<object>()
            {
                new Dictionary<string, object>() {
                    { "txid","3e4ea28160a9d5c9b01096ee17215e4bf6d3450ba97a963e3e8b8d969e04d303"},
                    { "vout", 0} }
            };

    List<object> txOut = new List<object>()
            {
                new Dictionary<string, float>
                {
                    { TestNet_ReceiverAddress, 1.0f}
                },
                new Dictionary<string, float>
                {
                    { "TestNet_SenderAddress", 48.99900f }
                },
            };

    RPCResultPrime<string> rawResult = await disp.CreateRawTransactionAsync(txIn, txOut);

    if (rawResult.Error == null)
    {
        string TxRaw = rawResult.Result;

        Dictionary<string, object> param = new Dictionary<string, object>()
                {
                    {"hexstring", TxRaw },
                    {"privkeys", new string[] { PrivateKey }},
                    {"prevtxs", new List<object>(){ prevTx } }
                    {"sighashtype", "ALL" }
                };

        string signedTx = await disp.SignTransactionAsync(param);

        //at this point transaction signed successfully but could not be Decoded in the next step

        string decode = await disp.DecodeRawTransactionAsync(signedTx);

        string jsonSend = await disp.SendRawTransactionAsync(signedTx);

        Debugger.Break();
    }

}

You are passing the parameter with signedTx incorrectly. A JSON-RPC param key must have a value that is either an array or an object. You are passing in a string. Instead you should pass in the parameter similarly to how you did for the signrawtransactionwithkey call.
You should have something like this:
     Dictionary<string, object> param = new Dictionary<string, object>()
            {
                {"hexstring", signedTx }
            };

    string decode = await disp.DecodeRawTransactionAsync(param);

The same should be done for sendrawtransaction.

With passing command as array or collection then
it  says it wants a string type parameter
{
"result":null,
"error":{ "code":-3,"message":"Expected type
string, got object"},
"id":null
}

What does the resulting command string that is sent to bitcoind look like?

"method":"signrawtransactionwithkey",
"params":
{
"hexstring":"0200000001810211089221fb6f6e0d0a4d5805f938f",
"privkeys": ["{"result":"cR4zAfhBqYb5zopnzbSPapHGMHzA","error":null,"id":null}\n"],
"prevtxs":
[{
"txid":"20715ec617522f2530530828c8ab09fd38f905584d0a0d6e6ffb219208110281",
"scriptPubKey":"210346335c729cda01ae00f29ebf9e3b31431ef4f6eb89a50fb4846ce3f4dd2a714dac",
"vout":0,
"amount":50.0
}],
"sighashtype":"ALL"
}

sorry, I can't formated comment to display correctly, and to fit into space I discard some text form "hexstring" and "privkeys"

The problem is how you are passing privkeys here. You are giving an array of objects, but it is expecting an array of strings.

Seems to be able to be decoded:
$ bitcoin-cli -regtest decoderawtransaction 020000000103d3049e968d8b3e3e967aa90b45d3f64b5e2117ee9610b0c9d5a96081a24e3e000000004847304402201921a1acf601acb0f9e6297a55eeb853c2dd6cd246ea05f060eaa4d327d4124a02206e08e2c90b92113a64d6de1447f81bf19703f88bffeacc6d2cc4bf0e21ed8ac501ffffffff0200e1f5050000000017a9140796253e13d88cda530bf88b07eb1672952a3a7887608a0e24010000001976a914957b73da3bf34440ab2f78937a7a420835255a0988ac00000000
{
  "txid": "9cbedd5f9674aff9fff890cec60aa38dba074fcc3984c5a2b760ff69d2c9ea3f",
  "hash": "9cbedd5f9674aff9fff890cec60aa38dba074fcc3984c5a2b760ff69d2c9ea3f",
  "version": 2,
  "size": 189,
  "vsize": 189,
  "weight": 756,
  "locktime": 0,
  "vin": [
    {
      "txid": "3e4ea28160a9d5c9b01096ee17215e4bf6d3450ba97a963e3e8b8d969e04d303",
      "vout": 0,
      "scriptSig": {
        "asm": "304402201921a1acf601acb0f9e6297a55eeb853c2dd6cd246ea05f060eaa4d327d4124a02206e08e2c90b92113a64d6de1447f81bf19703f88bffeacc6d2cc4bf0e21ed8ac5[ALL]",
        "hex": "47304402201921a1acf601acb0f9e6297a55eeb853c2dd6cd246ea05f060eaa4d327d4124a02206e08e2c90b92113a64d6de1447f81bf19703f88bffeacc6d2cc4bf0e21ed8ac501"
      },
      "sequence": 4294967295
    }
  ],
  "vout": [
    {
      "value": 1.00000000,
      "n": 0,
      "scriptPubKey": {
        "asm": "OP_HASH160 0796253e13d88cda530bf88b07eb1672952a3a78 OP_EQUAL",
        "hex": "a9140796253e13d88cda530bf88b07eb1672952a3a7887",
        "reqSigs": 1,
        "type": "scripthash",
        "addresses": [
          "2MswLavAixrNJY2eN58LLT6xjwLqouwvASn"
        ]
      }
    },
    {
      "value": 48.99900000,
      "n": 1,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 957b73da3bf34440ab2f78937a7a420835255a09 OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a914957b73da3bf34440ab2f78937a7a420835255a0988ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "mu9LsGdG3KFnpgB3Vx8w1sg8uCLb4gn3Uk"
        ]
      }
    }
  ]
}

yes you'r right, it's works fine with bitcoin-cli, but return error when called through the RPC in code. i am a little bit confused to where to looking for cause of error

Are you using a library, where is SignTransactionAsync defined?

It's a helper method, just cover parameter passing and Http methods

I am testing it with both depricated "signrawtransaction" and new one "signrawtransactionwithkey" but got the same error

would need to see the function definitions

public async Task SignTransactionWithKeyAsync(Dictionary<string, object> param)
{
RPCCommand cmd = new RPCCommand()
{
Method = "signrawtransactionwithkey",
Params = param,
Id = 0
};
string cmdRequest = server.SerializeCommand(cmd, true);

string jsonStr = await server.PostCommand(cmdRequest, server.serverAddress);

return jsonStr;
}

I don't know what RPCCommand() does


text:
Given a tx hash, is it possible to know if it's someone selling or buying bitcoin?
I'm working on a project that involves identifying sales and purchases in the Blockchain. Is there any way to do this with the blockchain.com API?

Added an answer that explains possible ways, however this doesn't involve blockchain.com API. If you can edit you question, it would be more relevant

The blockchain only records transfers of Bitcoin, and there is no reason to believe that every payment is linked to trading activity. The blockchain does not record reasons why funds were transferred, and it most certainly doesn't record trading activity. How could it, when trading inherently involves the exchange for another good, service, or currency which per definition is not recorded on the Bitcoin network. It's not clear to me why you'd expect to be able to extract this information whatsoever.

This is partially possible via anonymity analysis via heuristics like clustering. There are websites like wallet explorer which have list of known exchange addresses inferred by a mix of clustering analysis and manual user tagging. Similar analysis is done by blockchain forensic firms like elliptic
If most of inputs have been identified as belonging to an exchange, then it is typically a sell. Sell transactions would also normally contain lots of outputs as exchanges batch their sends to minimize fee.
For buy transaction some outputs would belong to an exchange and  it would typically be small transaction (2-4 outputs).


text:
I have lost 1 of my 2 of 3 multisig seeds. How do I restore to make a transaction?
I come to you a little bit desperate, hoping for a clue to move forward.
Long ago, I created 3 seed phrases, and then made a 2 of 3 multisig wallet with these 3. I did all of this using Cold Cards
For each, I engraved metal plates with the seed phrase, derivation path, fingerprint and zpub.
I tested each of the 3 and restored them to validate I had enough information to access my funds from each individual wallet.
In addition, I used the 3 plates to restore the entire multisig wallet and validated I could access my funds from the multisig wallet too.
I stored each of the three plates in a different location, as conventional wisdom dictates. This means that I can secure the other two in the event that any one is compromised.
Unfortunately the worst has happened and one of my sites was ransacked during a time period in which I could not access it due to travel restrictions. This is a hard lesson learned. Fortunately (I thought) I still have access to the other 2 seed phrases and respective details.
So I immediately retrieved the other 2 seed phrases and began to attempt to restore them.
As I previously validated, I can access each of the 2 wallets using their seed phrases. However, I cannot access the majority of my funds as during the software wallet setup stage (Sparrow wallet, but I have since tried countless others) it asks me for the zpub of all 3 seed phrases to generate the watch only multisig wallet.
As such here I am, with 2 of my 3 seed phrases, unable to access my funds.
Is all hope lost? Can anyone help me access my funds?
Cheers

I think hope is lost, but let's give it a try...
You mentioned, you created all of this using coldcards. As coldcard is a stateful wallet, meaning each device itself needs the full multisig-wallet information (derivations, fingerprints, xpubs) for it to sign a multisig-transaction, maybe the full public key information is still saved on one of the coldcards?
How did you coordinate the multisig-wallet in the first place?
If you, at the time, followed coldcards tutorial there should've been a step where you handed the multisig-wallet information to each of the devices (by passing the SD card around). This is also true for software wallets (although not every software wallet has a prompt to do that...).
GL

Also, if you delete files off of an SD card, the files can possibly be recovered if a new files hasn't been written over the location it was saved.  Immediately stop using the SD card and try a data recover tool such as https://www.cgsecurity.org/wiki/TestDisk  Using the disk increases the probability that you corrupted the deleted file (especially writing to the disk).

Thanks for adding your answer, that's a great idea.

Unfortunately, you need two private keys to spend but all three public keys to recreate the redeemscripts of the addresses. Unless you have a way to find out the third public key, you will not be able to spend.

I don't get it: more than just two private keys are needed to spend from a 2-of-3 wallet??  Did the OP, Ben, mention that he did something different from standard multisig wallet creation that needed more than 2 of 3 keys to recover?  You say, "you need two private keys to spend..." but then you also say you also need a third public key to spend.  Why does Ben need a "redeem script"?

@zylstra: Yes, you need all the public keys in order to reconstruct the redeemScript or witnessScript you need to show and satisfy in the input. The output script only contains the hash hash of that script. If you do not know one of the public keys, you generally cannot produce the script, since it is infeasible to guess the preimage of a hash. See also: https://bitcoin.stackexchange.com/q/119686/5406

WTF?!  I have been learning about crypto and multisig for years (though granted I haven't made a multisig wallet yet) and all I've ever read is that you need only two seed phrases to recover a 2-of-3 wallet.  ...Wow ...just wow.

Yeah, my impression was that most guides stress this point hard in the context, but it’s a bit unintuitive. Thanks for the reminder, I posted about it again.

If you have reused addresses (spending from an address at least once and then later receiving more to the same address), then you can find those balances because input scripts will reveal all 3 public keys of the individual address.
To recover, you must figure out how to:

Scan the blockchain for these addresses. You need to:

Download the entire blockchain
Use your 2 xpubs to create a list of individual public keys
Filter all transactions for inputs whose input script (specifically, redeem script) pattern-matches any of the public keys

Figure out how to construct a TX using the 2-of-3 P2SH multisig, then sign using the 2 keys you have.

Or, if you already know some addresses that were used before (like an address from some exchange's which you can find in your exchange history), just go and check them on a block explorer, if the address was spent from at least once, you can recover any balances still on it.
I'm not aware of any software that would let you do this easily. Good luck!


text:
do Bitcoin full node onions also relay non-bitcoin traffic?
During the past week or so I am setting up a Bitcoin core full node on Raspberry Pi and making it as secure as possible. In the public mind, the onion sites and Darknet are associated with many things which are illegal. I am trying to figure out how to configure my full node to pass through only the bitcoin related traffic. Is such a configuration possible at all?


text:
Does an actual transaction happen on the blockchain when you buy btc/usdt?
I was wondering if I buy or sell something on the exchange if coins are actually transfered somewhere of if the exchange just changes values of what belongs to me.

No, when you buy Bitcoin from an exchange, it is not an on-chain transaction, the exchange simply updates your account balances in their database.
It only becomes an on-chain transaction when you either deposit or withdraw Bitcoin to or from a Bitcoin address, from your exchange account.


text:
Transactions for multiple crypto-currency coins in cold storage without downloading full block-chains
I've searched on the internet and still unable to understand the usage of cold storage. Actually, I want to buy a few types of low price crypto currency coins and save them in my personal devices or papers. Later I need to send them to some exchanges to sell at higher price. I don't want to rely on online sites/firm meanwhile before exchange. Neither I want to download blockchains of each currency.
So, how can I efficiently save my coins in my personal captivity? If I use offline wallet generator, how In-ward and Out-ward transactions will be carried out?

If the given wallet supports it, you go to the console and type "importprivkey" and then your private key (usually in what is called WIF, or Wallet Import Format).  That, however, will give control of that address to that program.
The other way to do it is to manually create a transaction (on your own, using hashing websites, calculators, converting numbers etc) and then going into the console of the relevant wallet and typing "sendrawtransaction".
There is also concern regarding the full security of such behaviors but I am not referencing that here.

This is probably a question for a longer discussion, less for an q&a forum :-) There are too many opinions on how to, based on the desired outcomes and values (and paranoia). The higher the values, the more important is a proper stress tested storage system. My current solution would be a mix of virtual machines and different hardware.
I think of storing several altcoins in several cold wallets (offline). My major concern would be data loss due to broken hardware. Therefor I'd have two or better three backups. I would create several offline PCs in virtual machines/environments, and also have an offline Linux, and maybe an older MacOSX and/or some RaspberryPIs (all offline). All systems have one advantage over the other. In the virtual machines I would try to setup a wallet, by compiling myself. If not, I take a default wallet. Once the procedure is "clean", I can do the same on an offline PC. It's astounding, how many dependencies there are...
I would install the default wallets on the offline machines, note down the priv keys and/or seeds, capture a photo of the priv key/seeds (make sure your mobile doesn't sync the photo to the network, and delete it after downloading!), and keep it written down and/or somewhere in a veracrypt container on the different offline PCs. It is good to distribute, hardly all break at the same time. Also I note down the public keys and/or addresses. Then in the exchanges, one could send keys to "my" addresses.
I wouldn't download all the blockchain(s), that is not required. For example in Bitcoin, it is sufficient to have the priv key, to get it loaded in an SPV wallet like Electrum. In Ethereum there is MyEtherWallet. Other cryptos only have the "full client", which make it a bit more difficult, when it comes to spending. The clients might not recognize the funds, which have been sent from an exchange to the cold storage since its inception. As long as there is no SPV type wallet, you would have to download the chain up to the point, where you received last funds, or assemble a tx yourself, and send it to the network. I have done this several times with bitcoin, but never for altcoins...
You asked for an efficient process, my guess is, there isn't. I leave it to the audience, to convince me of the opposite :-) There are too many dependencies and different requirements, even if you have the technical understanding, implementing a wallet and being able to cold storage still requires a good thinking on process and trying it out regularely. I'd be very annoyed, if I think I have saved my data, just to discover one day, things have changed and I cannot access funds!
Here in the forum are many links to the keyword "cold storage", and over at bitcointalk as well. So my post is not at all covering all and every options. Maybe people can share some more options.

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


text:
Decode Input-Script Number
You can divide on some pages the input script number in R and S. Now I wanted to ask if someone can tell me a Python code how to divide the input script number into R and S or can define, so I have only R and S.
Thank you
example Number:4830450221008377df63977c2b3212f11ffbf098b328b4f246a86d131faa75effe53cef8568a02200c7187e5898f4dc605819bb6cdb7e357ec6993ce1ad11a87a621a7a579fe6d92014104a2b3aef09705da98696f357dfa78605f6490f4115d55a8e0a5ada4152f77a50e4faa479b0ed241bb8699e356644dbe8de5058c2bbb739e42f8928e95ad8d7a18

I have no ready-usable python code, and doubt there is. But here is the transaltion and details, which I generated with a set of shell scripts. This explains, and should help you to get started. More details can be found by searching the web for "ECDSA signature" and "ASN1-DER structure".
    48: OP_DATA_0x48:        push hex 48 (decimal 72) bytes on stack
    30: OP_SEQUENCE_0x30:    type tag indicating SEQUENCE, begin sigscript
    45: OP_LENGTH_0x45:      length of R + S
    02: OP_INT_0x02:         type tag INTEGER indicating length
    21: OP_LENGTH_0x21:      this is SIG R (33 Bytes)
        008377DF63977C2B:3212F11FFBF098B3
        28B4F246A86D131F:AA75EFFE53CEF856
        8A
    02: OP_INT_0x02:         type tag INTEGER indicating length
    20: OP_LENGTH_0x20:      this is SIG S (32 Bytes)
        0C7187E5898F4DC6:05819BB6CDB7E357
        EC6993CE1AD11A87:A621A7A579FE6D92
    01: OP_SIGHASHALL:       this terminates the ECDSA signature (ASN1-DER structure)
    41: OP_DATA_0x41:        length uncompressed Public Key (X9.63 form, 65 Bytes)
        04A2B3AEF09705DA:98696F357DFA7860
        5F6490F4115D55A8:E0A5ADA4152F77A5
        0E4FAA479B0ED241:BB8699E356644DBE
        8DE5058C2BBB739E:42F8928E95AD8D7A
        18

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


text:
Decoding ScriptSig
I noticed that there can be what seems to be more than 1 signature in a ScriptSig.
The transaction in question is: https://blockchain.info/tx/32e8677c968981549acc25f46641c74a3055d949c90bd22c15a5236bf92a622d
Below is a ScriptSig sample in question:

ScriptSig: 0[]
  PUSHDATA(71)[304402201c45383cc6e43202ed069e36184a97bf5dd489c6bea1372629540dea154c424902200a950b3557bba9ae9531237d46e6eb1afffd01eba989c3e53adaac443e5e2a2e01]
  PUSHDATA(71)[3044022032a681fb77589ce1a29a84494a6f9cb19630fcd65480ff646f30d8b826980390022006dc71baba1142abb275bbf3613b2a13b347bac4d09d41ccd9b69b02c270d8c201]
  PUSHDATA1[522103745aaaf364030720b2d14de50a3310eef521c91e36353dca20813713535c005a2102db8911b3989b43c43d8dd6e50459bd85c38faf3b2862eb78ef297002775a10bd210351e3f71b7cf9a5f5f86c1908fee02ebf5a1ed77b6748f7486505d155833645f253ae]

The above text is taken from blockchain.info webpage for the first ScriptSig in that particular transaction.
It seems like there is 2 pieces of PUSHDATA(71)304402...01 and from the sequence and formatting, it is a DER encoded signature.
My question would be how would there appear to be 2 pieces of PUSHDATA(71)304402...01 which is 2 pieces of digital signatures ?
Shouldn't a private key only generate a single digital signature and not two ?
Also, how do I interpret the final chunk regarding the PUSHDATA1[5221...53ae]

This is a 5 input one output multisig transaction. The decoding of the first sigscript
0047304402201C45383CC6E43202ED069E36184A97BF5DD489C6BEA1372629540DEA154C424902200A950B3557BBA9AE9531237D46E6EB1AFFFD01EBA989C3E53ADAAC443E5E2A2E01473044022032A681FB77589CE1A29A84494A6F9CB19630FCD65480FF646F30D8B826980390022006DC71BABA1142ABB275BBF3613B2A13B347BAC4D09D41CCD9B69B02C270D8C2014C69522103745AAAF364030720B2D14DE50A3310EEF521C91E36353DCA20813713535C005A2102DB8911B3989B43C43D8DD6E50459BD85C38FAF3B2862EB78EF297002775A10BD210351E3F71B7CF9A5F5F86C1908FEE02EBF5A1ED77B6748F7486505D155833645F253AE

can be decomposed into these sections:
       00
sig1   47304402201C45383CC6E43202ED069E36184A97BF5DD489C6BEA1372629540DEA154C424902200A950B3557BBA9AE9531237D46E6EB1AFFFD01EBA989C3E53ADAAC443E5E2A2E01
sig2   473044022032A681FB77589CE1A29A84494A6F9CB19630FCD65480FF646F30D8B826980390022006DC71BABA1142ABB275BBF3613B2A13B347BAC4D09D41CCD9B69B02C270D8C201
length 4C69
OP_2   52
pk1    21 03745AAAF364030720B2D14DE50A3310EEF521C91E36353DCA20813713535C005A
pk2    21 02DB8911B3989B43C43D8DD6E50459BD85C38FAF3B2862EB78EF297002775A10BD
pk3    21 0351E3F71B7CF9A5F5F86C1908FEE02EBF5A1ED77B6748F7486505D155833645F2
OP_3   53
check  AE

So this is a two of three multisig tx, which has provided two signatures, and three public keys. To explain each command, here are the details:
00: OP_0, OP_FALSE:      an empty array is pushed onto the stack.
47: OP_DATA_0x47:        push hex 47 (decimal 71) bytes on stack
30: OP_SEQUENCE_0x30:    type tag indicating SEQUENCE, begin sigscript
44: OP_LENGTH_0x44:      length of R + S
02: OP_INT_0x02:         type tag INTEGER indicating length
20: OP_LENGTH_0x20:      this is SIG R (32 Bytes)
    1C45383CC6E43202:ED069E36184A97BF:5DD489C6BEA13726:29540DEA154C4249
02: OP_INT_0x02:         type tag INTEGER indicating length
20: OP_LENGTH_0x20:      this is SIG S (32 Bytes)
    0A950B3557BBA9AE:9531237D46E6EB1A:FFFD01EBA989C3E5:3ADAAC443E5E2A2E
01: OP_SIGHASHALL:       this terminates the ECDSA signature (ASN1-DER structure)
#########################################################
47: OP_DATA_0x47:        push hex 47 (decimal 71) bytes on stack
30: OP_SEQUENCE_0x30:    type tag indicating SEQUENCE, begin sigscript
44: OP_LENGTH_0x44:      length of R + S
02: OP_INT_0x02:         type tag INTEGER indicating length
20: OP_LENGTH_0x20:      this is SIG R (32 Bytes)
    32A681FB77589CE1:A29A84494A6F9CB1
    9630FCD65480FF64:6F30D8B826980390
02: OP_INT_0x02:         type tag INTEGER indicating length
20: OP_LENGTH_0x20:      this is SIG S (32 Bytes)
    06DC71BABA1142AB:B275BBF3613B2A13
    B347BAC4D09D41CC:D9B69B02C270D8C2
01: OP_SIGHASHALL:       this terminates the ECDSA signature (ASN1-DER structure)
#########################################################
4C: OP_PUSHDATA1:        next byte is # of bytes that go onto stack
69: OP_Int(0x01-0xff):   105 bytes onto the stack
52: OP_2:                the number 2 is pushed onto stack
    ################### we go multisig ####################################
21: OP_DATA_0x21:        compressed pub key (33 Bytes)
    03745AAAF3640307:20B2D14DE50A3310:EEF521C91E36353D:CA20813713535C00:5A
    This is MultiSig's compressed Public Key (X9.63 form)
    corresponding bitcoin address is:    1GNXpcYzasmmXvM4rNgkvZ5SzXgL4L9Ch6
21: OP_DATA_0x21:        compressed pub key (33 Bytes)
    02DB8911B3989B43:C43D8DD6E50459BD:85C38FAF3B2862EB:78EF297002775A10:BD
    This is MultiSig's compressed Public Key (X9.63 form)
    corresponding bitcoin address is:    1KHCXt29T7cHfPA88SpPL128h9PyZMi2uR
21: OP_DATA_0x21:        compressed pub key (33 Bytes)
        21: OP_DATA_0x21:        compressed pub key (33 Bytes)
    0351E3F71B7CF9A5:F5F86C1908FEE02E:BF5A1ED77B6748F7:486505D155833645:F2
    This is MultiSig's compressed Public Key (X9.63 form)
    corresponding bitcoin address is:    1PjUtVWKkr2GxA5HrkAmvhpyHGUwNPyQzH
53: OP_3:                the number 3 is pushed onto stack
    ################### 2-of-3 Multisig ###################################
AE: OP_CHECKMULTISIG:    terminating multisig
    corresponding bitcoin address is:    33jhmQXe4Q9dP24Jm9EVa6XHxn85sZnQMR

Now if all this looks like being to much for the beginning, I recommend reading Andreas' book "Mastering Bitcoin", here especially chapter 7 "Advanced Transactions and Scripting".


text:
Can a Bitcoin response contain multiple Bitcoin messages?
I sent a Version message shown below:
F9BEB4D976657273696F6E0000000000560000003EA2EDFF7111010001000000000000003CE5725A00000000010000000000000000000000000000000000FFFF5B86CFD0208D010000000000000000000000000000000000FFFF________208D847C51678AA429DE000000000000

I received the following message:
F9BEB4D976657273696F6E0000000000680000002C00D4E37F1101000D00000000000000DCE0725A00000000010000000000000000000000000000000000FFFF________208D0D00000000000000000000000000000000000000000000000000E665131FDCB099B0122F5361746F7368693A302E31352E302E312FC7BC070001F9BEB4D976657261636B000000000000000000005DF6E0E2

The response received is in a TCP packet itself and from the packet, it seems like there is two Bitcoin protocol messages in a single TCP packet response.
Dissecting the above response, it is made of a VERSION command that is replied to me:
F9BEB4D976657273696F6E0000000000680000002C00D4E37F1101000D00000000000000DCE0725A00000000010000000000000000000000000000000000FFFF________208D0D00000000000000000000000000000000000000000000000000E665131FDCB099B0122F5361746F7368693A302E31352E302E312FC7BC070001

And also a VERACK response:
F9BEB4D976657261636B000000000000000000005DF6E0E2

Is it a typical behavious for Bitcoin protocol to bunch up as much messages into a single TCP packet before sending it out ?
Note: Both messages have IP address cleaned out via underscore marks.

Is this happening only for the VERSION/VERACK messages?

I am using a TCP manipulation software to understand the protocol of Bitcoin and while experimenting, I have seen more than just VERACK. There is also the ALERT message (as I am emulating version 70001).

Do you mean the three on the same message?
I understand you're controlling both nodes, and using the same client (Bitcoin Core 0.8.0?). Is that correct?

I am using a TCP manipulation software and sending it out to a public node that I do not control. So, I have my emulator acting as a 70001 node and some unknown public node on the Internet that I am randomly interacting to.

Well, I keep thinking my answer is the most reasonable I can imagine.
Since nodes advertise their client too, you could try to see if different clients act in a different way, or if this piggybacking behavior is used by all.
Also you can see if it is used for all messages or just specific ones (usually this technique can only be used when you can have the response message in a short time, so as not to make the other node waiting too much for the ack).
Let us know what you find out :)

In TCP communications it is common to use a technique known as "piggybacking".
Let's say A and B are communicating over TCP. Normally, after receiving a message from A, B should send an ACK message to let A know he received it correctly. In order to minimize the number of messages, B can "encapsulate" the response message into the ACK, so that A will receive the response along with the ACK.
Since Bitcoin works on TCP, it is reasonable that the same technique is applied.


text:
Requesting for verbose output from ElectrumX
I am trying to request for information regarding a particular transaction in verbose mode from an ElectrumX server with protocol v1.2 and above.
I have checked the version via a server.version to ensure that the protocol is 1.2
{"method":"server.version","id":0,"params":["Test01","1.2"]}

With server replying:
{"result":["ElectrumX 1.4.3","1.2"],"id":0,"jsonrpc":"2.0"}

And it has a feature list of:
{"result":{"pruning":null,"protocol_max":"1.2","protocol_min":"1.0","genesis_hash":"000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f","hosts":{"electrum.poorcoding.com":{"tcp_port":50001,"ssl_port":50002},"ruuxwv74pjxms3ws.onion":{"tcp_port":50001,"ssl_port":10042}},"hash_function":"sha256","server_version":"ElectrumX 1.4.3"},"id":0,"jsonrpc":"2.0"}

I tried to issue the following JSON-RPC command:
{"method":"blockchain.transaction.get","id":0,"params":["fc992bd10bbcbd54ee2279de497ad4bd49ce6a64c27f2a2d3293f761d2a5a3a3"],"verbose":true}

The result wasn't the verbose mode I was expecting:
{"result":"020000000b2356969c58611df9ccbf4ebe064a33a63c71f0e04ab39ccb530331e45971cddf000000006a47304402201a9eb199f2fff91d8e9fe416e2fd8245a5e200a2aa3110691c24bc24aef42e6a022029355d6a9ab1e9e14a3a5729303c2c97143570b451803ec210a2def6a8a7e8e5012103638a747b2e4339a9aefe09b43b4b7f12bd044d0cfa158472199b9f9dfc1cb58dfeffffff2e126381ff3c7c0e30b17399f6a89056480f9063c1b807af3f2d6d1c18cba003000000006a47304402203d686197e00d7056052171af0a92a46ffffdf6be44ae6f18e44a1e5fcd9692e20220683d450e22ad809126decb916272543de0af257ea5d0d2210bb349f3e862fc4a012102e12564a5853be9f541d4887713e61645c2c67ccecef80b1c7dfd43b6b4d34cb6feffffff3c69858b6e56aa9167b6ece5308d73f739a779a5910ca392bbfca8aa890b0d97010000006a473044022019fb37069222a7f10fdf23be9a7c44c829029eb910595083e6660f556b55bf090220019b8fe7a970718f7f0dba481aa588b63b00d5981e896bc485c7e27366982b8b01210353a42fb6331646bb675bebec7feed6259bebac36080e01c9306478c0a1440e28feffffff43d5db04b65c6cbbc6a1ba94244b5ed769969dfa55b7a6bceb6e2b856ca69f7c000000006a47304402200bfb13afc5bcff8d1314395dd5b7a1c0b98c0974eca9468b84f9e2cd41e674bc02200eb8869ddcad81c2ba76ee4c29ebdf15a777f79acead35032cbe28fdb730cea4012102f5e23ab2d241967b8c94f71ad2caa439d2ddeb226dcfbf91b83ebf96d7e39deafeffffff8ec0499dbe894696ad85891f894195b43afc5423988fb82e387fb7084ef56394010000006a47304402204322bd70be2b69b134b54556642e2ba89ecec8c7fb4ebe89df002d9613e6e7de022057bb35ae64c864c30e6835b7184158b30c515bd79e4dcaf7c9228953d53211b201210304e2265d9f1a54166a7a69ac4441b5837ec5c337d6de50efb64314f500c14e7cfeffffffb491f4ca65f7fcd1ad41c2ddda2d4194c4682a1710cf3177d310294f5c5c6cd1010000006a473044022078e612c445732e8938422e8d27a82918684df5c4fc7b8a140771fe1b596e1e2802206f983b0f76f1c6f6158219dfc87c0832048861e0b1e3a7acff0c7364e57e1c4d012103367fd7df0cec3265141dba0d74d0e2dc07ecde54ec2d4a29eaf59efe09f05990feffffffbaf9790b819321f037e388bdcc1139ac6ac710b24497b0c4e546c7673e166677010000006b483045022100a74573768028d90643591dc5568ee10213599fdc0ffceb40a3a70553d541937102200c452638932694fec71d4ca96ae629bf21fde8c65c81e9442d88061c03d94f1901210286c4c51f0ed3a6557e4792faf272022c7a3ed65d19b8c59af1dd6fd8e7db5053feffffffcf2f37b6d4c373370c9d7e02f0c42b6b319655a5db01fd179c448b48a25e6047010000006a47304402202fc362704e2c0c6cfb9e43928c0ce7dcdbc9590b14481e13bd55702cfda6a682022066b2537ffcca3274ae4f34b6c76881004936481aa3e02e32659555fd6ba7a54601210387e001ccff8023655587386adf14ea44515edf9c5a2968d61c2ce2d77347fe42feffffffd077d21b7e3351cc97fdb791bec0201caa3eb0dfcf6431957d351f6f29bd8c59010000006a47304402204565364e236b884b3e1ef84733af01136f3fc7f70a6e10b8cd5aa8f2f0b47adf02200fd979321e7770fd7b44fbe325d41595ccbeeee3cfd090de9af5b727ce1be72c0121030140af643df18b4e01fe21f5b2801cf5072768a963f402532103e9d8e02bbddcfefffffff40b7483d185b5e0cba1b3996d80cb3d4895b4ae320ab18928aff80de1a89482010000006b483045022100b0ec6109bebcc4490b2ec909ca966681e15f63a29b138d468a13b4a94891ebdb022071645aff4b17f28b4ff7e754952d0da4ebf468e014cfcf0f08189153974d0faa012102613226d6cc0803a310c0ea9c79f95bad6546b5cc917d3a61c116980470fcf2e4fefffffff063056ef8112605847f620bd2cc9b682e0b5653a90df81c4e0c17d2e744b932850200006a473044022009ae6e6dbf70f38e1ec32ec64d9cd484179fd974277bd4a38209c7fd5e03942702201bb0244cd5da0858afb1f32f8eb8bf760a6aa537865e642ed1fd8233ba12638001210397adf156191c5c7947467d7b1d19a0f84d781c50efa24c32d8c4005a55851b7dfeffffff022e3f0e00000000001976a91425e789df00999740b6ed1a2cacf88ffbe8df8f4388ac209c7000000000001976a914c515337b8c81e8eb1b816426d45281a8aa65bbd388acbb050800","id":0,"jsonrpc":"2.0"}

The documentation page was lacking of sample on how to use the verbose mode:
https://electrumx.readthedocs.io/en/latest/protocol-methods.html#blockchain-transaction-get
I would assume the command I issued might have a problem or is the server simply issuing a 1.2 protocol but refusing to honor the verbose=true parameter which the documentation have specified ?

You should set verbose=true inside params array, try as follows:
{"method":"blockchain.transaction.get","id":0,"params":["fc992bd10bbcbd54ee2279de497ad4bd49ce6a64c27f2a2d3293f761d2a5a3a3","verbose":true]}

{"method":"blockchain.transaction.get","id":0,"params":["fc992bd10bbcbd54ee2279de497ad4bd49ce6a64c27f2a2d3293f761d2a5a3a3",{"verbose":true}]} was used and it yielded the same result.

You are still doing it the wrong way, please copy and paste what I've posted.

You don't have to set it into curly braces, remove them

Thanks. Got it. I also noticed that the server.version indicating a client supporting version 1.2 protocol and above before sending the above blockchain.transaction.get with verbose=true enabled for it to work.


text:
Decoding a Block beyond the Coinbase transaction
I am attempting to decode a Block and have managed to decode the Coinbase transaction but after the transaction, there is huge gaps in them that I do not understand.
Taking this Block as a sample: 0000000000000000002e5b55bf93c89cc3a41de24d762fa4f68e725da3b089ba
Here is my attempt to decode this block:

===== Block Begin =====
00000020 - Transaction Version
15F11A82BE84CCCAF4E59CFC0C89EF01CAD854DC15F33D000000000000000000 -
  Block Hash
CC2DCEAF96439181993C564CBE889F60FDB98E8EFD4E524D9EEA3C54CF400504 -
  Merkle Root
2BDF8F5A - Timestamp
DC975D17 - Bits
3E2A4065 - Nonce
FD8704 - Total Transaction
01000000 - Transaction Version
01 - Coinbase has 1 transaction
===== Coinbase Begin =====
0000000000000000000000000000000000000000000000000000000000000000 -
  coinbase hash
FFFFFFFF - index
45 - txin script length (69)
-> 03 - bytes in height
-> 43CA07FA - height
->
  BE6D6DCAEEFE495F6BCA08E10FF6D24555166C2456D8129213354E32FD73EB1B141AB00100000000000000036507000F312D7B080100275C012F736C7573682F
  - txin
00000000 - sequence
03 - 3 output in coinbase
AA5CB94C00000000 - output satoshis from coinbase
19 - Coinbase Output Script Length (25)
76 - OP_DUP
A9 - OP_HASH160
14 - 20 bytes
7C154ED1DC59609E3D26ABB2DF2EA3D587CD8C41 - hash data
88 - OP_EQUALVERIFY
AC - OP_CHECKSIG
00000000 - Lock Time
===== Coinbase End =====
000000002C6A4C2952534B424C4F434B3AA5BA6C5D1EFFA2034E994BEEE65C619DE2D2A1
  - outpoint ?
B91892F193C170CAB74F152EAE0000000000000000266A24AA21A9ED85F7D06CCF8014D990E0242ACC0433EAF134732094E9A083A45AC3799259C9170000000001000000014FFBE86D2805AF78459BBF5FA3432A5E9C84D408F7921BF2095488B9DDC39D33
  - ?
02000000 - Tx Version
6B - TxIn SigScript Length (107)
48 - TxIn SigScript Length (72)
3045022100FAD6F0A91A89A90D17800B55B1B1E424338BFB5D72D3970ED95310AFEB4734A50220120B24AF1444E520EB77ECE73DB6D9775159220B089D28948BC9DBC156C2492F01
  - TxIn SigScript
21 - TxIn SigScript Length (33)
02227CEDFAB55D1B7642D47A5AC92638ED8822A23C3DDADF88DEFEA45A37F5935E -
  TxIn SigScript
FFFFFFFF - TxIn Sequence
02 - TxOut Count
F0874B0000000000 - Satoshis (BTC 0.0495)
17 - Length (23)
A9 - OP_HASH160
14 - 20 bytes
98808E526D3737F044F2DD5445A27DB39BAD821D - hash data
87 - OP_EQUAL
92F6E73600000000 - Satoshis (BTC 9.21171602)
19 - Length (25)
76 - OP_DUP
A9 - OP_HASH160
14 - 20 bytes
B08F46E4D21CD0547A8A1E2E43E5440284F710A4
88 - OP_EQUALVERIFY
AC - OP_CHECKSIG
00000000 - Lock Time
=====================
01000000 - ?
01 - ?
DE74875C17CE6730AF727B52913FAB9FF7922BBA806932785A824A8CAA649E8D0100000000FFFFFFFF02D5C267130000000017A91433A9DB4ED408225EFE4B00DC55F962B52E8769B987A7C6D10200000000220020701A8D401C84FB13E6BAF169D59684E1 ... more data ...

It seems like after I have decoded the Coinbase transaction, the first proper transaction after the Coinbase, I hit a problem trying to resolve:

000000002C6A4C2952534B424C4F434B3AA5BA6C5D1EFFA2034E994BEEE65C619DE2D2A1B91892F193C170CAB74F152EAE0000000000000000266A24AA21A9ED85F7D06CCF8014D990E0242ACC0433EAF134732094E9A083A45AC3799259C9170000000001000000014FFBE86D2805AF78459BBF5FA3432A5E9C84D408F7921BF2095488B9DDC39D33

Only after that point, does the data look abit more familiar with the 02000000 which I have guessed is the Tx Version followed by what seems to be TxIn Script data and so on.
I would like some help to understand how to decode the Block as this is only that far I can guess after reading the Bitcoin documentations found online which are not documented in a uniformed and easy to ready manner.
Thanks for the help in advance.

Use blockchain.info: https://blockchain.info/rawblock/0000000000000000002e5b55bf93c89cc3a41de24d762fa4f68e725da3b089ba

The format for blocks is described here: https://bitcoin.org/en/developer-reference#serialized-blocks
The format for transactions is mostly described here: https://bitcoin.org/en/developer-reference#raw-transaction-format
However some transactions are segwit transactions, so they have a few additional fields that are not described in the above documentation. Those fields are described here: https://github.com/bitcoin/bips/blob/master/bip-0144.mediawiki

Your decoding is a bit wrong:

00000020 - Transaction Version

That's the block version, not transaction version.

01000000 - Transaction Version
01 - Coinbase has 1 transaction

You've actually missed two fields here. The first 7 bytes of the transaction are 01000000000101. These are as follows:
01000000 - Transaction version
00 - Segwit marker byte
01 - Segwit flag byte
01 - Number of inputs

Note that the segwit marker and flag bytes are only found in segwit transactions and indicate that a given transaction is a segwit transaction.

===== Coinbase Begin =====

The transaction version and the count after it all belong as part of the coinbase transaction. The count is not of the number of transactions but rather the number of inputs. A transaction is composed of inputs and outputs, not other transactions.

-> BE6D6DCAEEFE495F6BCA08E10FF6D24555166C2456D8129213354E32FD73EB1B141AB00100000000000000036507000F312D7B080100275C012F736C7573682F
  - txin

No, that's still part of the scriptSig. It itself is not a transaction input. This is just arbitrary data in the scriptSig of the coinbase transaction that miners put there.

00000000 - Lock Time
===== Coinbase End =====
000000002C6A4C2952534B424C4F434B3AA5BA6C5D1EFFA2034E994BEEE65C619DE2D2A1
  - outpoint ?
B91892F193C170CAB74F152EAE0000000000000000266A24AA21A9ED85F7D06CCF8014D990E0242ACC0433EAF134732094E9A083A45AC3799259C9170000000001000000014FFBE86D2805AF78459BBF5FA3432A5E9C84D408F7921BF2095488B9DDC39D33
  - ?

No, there are three outputs but you have only decoded one of them.
The proper decoding is as follows:
0000000000000000 - Amount in satoshis
2c - scriptPubKey is 44 bytes
6a - OP_RETURN
4c - OP_PUSHDATA1
29 - Push 41 bytes to stack
52534b424c4f434b3aa5ba6c5d1effa2034e994beee65c619de2d2a1b91892f193c170cab74f152eae - 41 bytes of data
0000000000000000 - Amount in satoshis
26 - scriptPubKey is 38 bytes
6a - OP_RETURN
24 - Push 36 bytes to stack
aa21a9ed85f7d06ccf8014d990e0242acc0433eaf134732094e9a083a45ac3799259c917 - 36 bytes of data. This data is the witness commitment as described in [BIP 141](https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki#Commitment_structure)

There is actually a next part of the transaction that you don't have in your breakdowt. It is the witness data and the locktime.
01 - One witness stack item
20 - Stack item is 32 bytes in length
0000000000000000000000000000000000000000000000000000000000000000 - Stack item
00000000 - locktime
Then the next transaction starts with 01000000014FFBE86D2805AF78459BBF5FA3432A5E9C84D408F7921BF2095488B9DDC39D33... and is decoded like the coinbase transaction above.


text:
Problematic Digital Signature with SECP256K1
I am trying to test out TestNet3 and I have a keypair generated using Java crypto library.
The private key is 23F847360E1EB348A212F443C633058080A8EB9F05AD132F8B82D51FE672EADD and the public key is 044C8478229D9A139803AB0889617ECB6421191F3D891D0817D6A6CFD43BCBAA206FA9CE781E1C48764D8D1D0CE58DC6DE76C1B5F97CBCB5C9F01960DEAD3E192F with the compressed form as 024C8478229D9A139803AB0889617ECB6421191F3D891D0817D6A6CFD43BCBAA20.
I derive a TestNet address resulting in msmVKMjAz7UdJSfkpvv3z4RMbt7pxocqZw and decided to use it to sign a transaction hash of C46A8842187BB3642463B020D63462800FFB45791284404A965EF027D9F3B473 using SHA256withECDSA mode.
The following R and S is generated as the Signature:
Component R: 038646375A34E4DA028B44362D1745870D019782245EF094AA788D17FD69F1D3
Component S: 00F29287B9A8913A9D751ECB33B32EEEB5614BAA32CF714811E29AE07F0886D4E7

My signing code is using BouncyCastle as the Java JCE provider as shown below:
System.out.println("BC Sign Begin");
System.out.println("=============");
X9ECParameters CURVE_PARAMS = CustomNamedCurves.getByName("secp256k1");
ECDomainParameters CURVE = new ECDomainParameters(CURVE_PARAMS.getCurve(), CURVE_PARAMS.getG(), CURVE_PARAMS.getN(), CURVE_PARAMS.getH());
ECDSASigner signer = new ECDSASigner(new HMacDSAKCalculator(new SHA256Digest()));
ECPrivateKeyParameters privKey1 = new ECPrivateKeyParameters(((ECPrivateKey) keys[0]).getS(), CURVE);
System.out.println("Curve A Coefficient (a): " + privKey1.getParameters().getCurve().getA().toBigInteger().toString(16));
System.out.println("Curve B Coefficient (b): " + privKey1.getParameters().getCurve().getB().toBigInteger().toString(16));
System.out.println("Curve G Generator X (Gx): " + privKey1.getParameters().getG().getAffineXCoord().toBigInteger().toString(16));
System.out.println("Curve G Generator Y (Gy): " + privKey1.getParameters().getG().getAffineYCoord().toBigInteger().toString(16));
System.out.println("Curve Order (n): " + privKey1.getParameters().getCurve().getOrder().toString(16));
System.out.println("Curve Cofactor (h): " + privKey1.getParameters().getCurve().getCofactor().toString(16));
System.out.println("Private Key In Use: " + ((ECPrivateKey) keys[0]).getS().toString(16));
signer.init(true, privKey1);
BigInteger[] components = signer.generateSignature(input1);
System.out.println("Component R: " + BinUtils.toHexString(components[0].toByteArray()));
System.out.println("Component S: " + BinUtils.toHexString(components[1].toByteArray()));
String compStrs = BinUtils.toHexString(components[0].toByteArray()) + "+" + BinUtils.toHexString(components[1].toByteArray());
System.out.println("Components String: " + compStrs);

The output:
BC Sign Begin
=============
Curve A Coefficient (a): 0
Curve B Coefficient (b): 7
Curve G Generator X (Gx): 79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798
Curve G Generator Y (Gy): 483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8
Curve Order (n): fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141
Curve Cofactor (h): 1
Private Key In Use: 23f847360e1eb348a212f443c633058080a8eb9f05ad132f8b82d51fe672eadd
Component R: 038646375A34E4DA028B44362D1745870D019782245EF094AA788D17FD69F1D3
Component S: 00F29287B9A8913A9D751ECB33B32EEEB5614BAA32CF714811E29AE07F0886D4E7
Components String: 038646375A34E4DA028B44362D1745870D019782245EF094AA788D17FD69F1D3+00F29287B9A8913A9D751ECB33B32EEEB5614BAA32CF714811E29AE07F0886D4E7
=============

When I use BitcoinJ to transmit my transaction to the TestNet, I am getting the following errors:
org.bitcoinj.core.ScriptException: Script resulted in a non-true stack: []
at org.bitcoinj.script.Script.correctlySpends(Script.java:1606)
at java.lang.Thread.run(Thread.java:744)
Hit an exception when trying to approve:
java.util.concurrent.ExecutionException: org.bitcoinj.core.RejectedTransactionException: Reject: tx e374f230fe59b91ff88cc81768c10cb0d3b651079383da4dcfa4ef54372dcbd7 for reason 'mandatory-script-verify-flag-failed (Signature must be zero for failed CHECK(MULTI)SIG operation)' (16)
at com.google.common.util.concurrent.AbstractFuture$Sync.getValue(AbstractFuture.java:299)
at com.google.common.util.concurrent.AbstractFuture$Sync.get(AbstractFuture.java:286)
at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:116)
Caused by: org.bitcoinj.core.RejectedTransactionException: Reject: tx e374f230fe59b91ff88cc81768c10cb0d3b651079383da4dcfa4ef54372dcbd7 for reason 'mandatory-script-verify-flag-failed (Signature must be zero for failed CHECK(MULTI)SIG operation)' (16)
at org.bitcoinj.core.TransactionBroadcast$2.onPreMessageReceived(TransactionBroadcast.java:102)
at org.bitcoinj.core.Peer.processMessage(Peer.java:461)
at org.bitcoinj.core.PeerSocketHandler.receiveBytes(PeerSocketHandler.java:184)
at org.bitcoinj.net.ConnectionHandler.handleKey(ConnectionHandler.java:223)
at org.bitcoinj.net.NioClientManager.handleKey(NioClientManager.java:86)
at org.bitcoinj.net.NioClientManager.run(NioClientManager.java:122)
at com.google.common.util.concurrent.AbstractExecutionThreadService$1$2.run(AbstractExecutionThreadService.java:60)
at com.google.common.util.concurrent.Callables$3.run(Callables.java:95)
at org.bitcoinj.utils.ContextPropagatingThreadFactory$1.run(ContextPropagatingThreadFactory.java:49)
... 1 more

Your compressed public key is wrong. It should be 034c8478229d9a139803ab0889617ecb6421191f3d891d0817d6a6cfd43bcbaa20. How did you construct it?


text:
How do i parse the zeroMQ messages in java?
This is the code that i have. I receive messages from the zeroMQ however a hashtx message for example looks like this --> "hashtx Ř�����v����|(8d �!��v��&�-�k�". Any help in turning that into a real hashtx is appreciated :)
public static void main(String[] args) {
    ZMQ.Context context = ZMQ.context(1);

    // Connect our subscriber socket
    ZMQ.Socket subscriber = context.socket(ZMQ.SUB);
    subscriber.connect("tcp://192.168.137.211:28332");

    subscriber.subscribe("rawblock".getBytes());
    subscriber.subscribe("hashblock".getBytes());
    subscriber.subscribe("rawtx".getBytes());
    subscriber.subscribe("hashtx".getBytes());

    while (!msg.equalsIgnoreCase("END")) {

        String printMe = new String(subscriber.recv());
        System.out.println(printMe);

    }

}

I wish I had an answer of the to of my head, but I can tell you this:  zeromq isn't a format, it's a transport medium.  It can transport any format, but you are aiming it's a string.  It's not.  You need to read the spec to find out how to interpret the bytes you receive.

Ok so i found the solution. The "hashtx, hashblock" etc messages are sent as raw binary bytes which then need to be converted to hexadecimal.
Here is my code.
public static void main(String[] args) {
    ZMQ.Context context = ZMQ.context(1);

    // Connect our subscriber socket
    ZMQ.Socket subscriber = context.socket(ZMQ.SUB);
    // Synchronize with the publisher
    subscriber.connect("tcp://192.168.137.211:28332");

    //subscriber.subscribe("rawblock".getBytes());
    //subscriber.subscribe("rawtx".getBytes());
    //subscriber.subscribe("hashtx".getBytes());
    subscriber.subscribe("hashblock".getBytes());

    System.out.println("Subscribed.. Waiting for messages.");
    while (true) {

        ZMsg zMsg = ZMsg.recvMsg(subscriber);
        System.out.println("New message received!");
        int messageNumber = 0;
        for (ZFrame f: zMsg) {
            byte[] bytes = f.getData();
            System.out.println("Message number: " + messageNumber + " | Byte array length: " + bytes.length);
            if (messageNumber == 0){
                String messageType = new String(bytes);
                System.out.println("Message type: " + messageType);
            } else if (messageNumber == 1) {
                String message = Converter.bin2hex(bytes);
                System.out.println("Message: " + message);
            }
            messageNumber++;
        }

    }
}

and the binary to hex converter class
import java.util.Formatter;
public class Converter
{
private Converter() {
    throw new IllegalStateException("Utility class");
}

public static String bin2hex(byte[] bytes)
{
    Formatter f = new Formatter();
    try {
        for (byte c : bytes)
            f.format("%02X",c);

        return (f.toString().toLowerCase());
    } finally {
        f.close();
    }
}

public static String hex2bin(String hexString)
{
    if (!hexString.matches("^[0-9a-fA-F]+$")) {
        return null;
    }
    StringBuilder output = new StringBuilder();
    for (int i = 0; i < hexString.length(); i+=2) {
        String str = hexString.substring(i, i+2);
        output.append((char)Integer.parseInt(str, 16));
    }
    return output.toString();
}
}

Bitcoin Core does not give you strings for the data from ZMQ. It provides the raw bytes of the transactions, blocks, and their hashes. You will need to interpret the received data as byte arrays and handle them appropriately.


text:
Correct way to use joinpsbt for manual coinjoin?
I am developing a feature in my app for "manual coinjoins" which follows this as inspiration: https://github.com/bitcoin/bips/blob/master/bip-0174.mediawiki#Manual_CoinJoin_Workflow
I am not an experienced coinjoin user and just want to make sure I am not missing something here.
The flow I am using is:
User A creates a PSBT with one utxo input of 0.1 btc and one output of 0.0995 btc sending the output to a new address of theirs.
User A processes the PSBT to sign for the input.
User A passes the PSBT on to user B who creates another PSBT with identical input amount and identical output amount and processes the PSBT to sign the input.
User B can pass it on to others who repeat the process or finalize and broadcast.
Is this the proper way to do it? Does the order in which the users process the PSBT with their wallet matter?

No, that won't work. joinpsbts must be used before any signatures are created. Otherwise existing signatures will not be valid for the joined transaction. Rather, each person must create their own PSBT, send them to each other or to some coordinator where the PSBTs are then joined together with joinpsbts. Then the joined PSBT can be distributed back to everyone, who processes and signs it. Once signed, each person must, again, send the signed PSBT to everyone else or to the coordinator where all the PSBTs are combined with combinepsbt. Then the combined PSBT can be finalized and broadcast.
Note that currently joinpsbts has a major privacy leak as the inputs and outputs are added to the joined PSBT in the order that the transactions were specified. There is an open Pull Request that fixes this issue.

This is going to be an amazing feature, any ideas when that PR may get merged?

Is this working? We tried to reproduce step by step but we can't sign the joined transactions

@JuliSmz As far as I know, nothing has changed with joinpsbts.


text:
Issuing bitcoin-cli commands via terminal
I am having issues utilizing bitcoin-cli via terminal. For example:
DIRECT-8A-HP-OfficeJet-4650:~ peter$ bitcoin-cli deriveaddresses "wpkh(xpub6Dy2ikUu5mXbDdhw2vAP1C4eiQM8rTz1NiWQt2BzGi83iHC2gEgTSD54JveyuHF9VLAqNkCGnee1jdBL7nA3JNorbqjSSS8DEV6Hn3PuNBt/*)#mn5jvyc3" 99
error code: -8
error message:
Range must be specified as end or as [begin,end]
DIRECT-8A-HP-OfficeJet-4650:~ peter$
However the exact same text in the Bitcoin Core console works without issue.
What am I doing wrong?

Are you running bitcoin-cli on a printer?

Haha, no, I have to disguise the hotspot I create at work.. I am living under harsh conditions ;)

I figured out a solution, just use curl in the terminal which communicates the commands via binary data.


text:
Using importmulti with internal set to true does not add any change keys. What am I doing wrong?
First I call:
curl --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "createwallet", "params":["ColdWallet", true] }' -H 'content-type: text/plain;' http://user:password@127.0.0.1:18332/

Which returns:
result = {
    name = ColdWallet;
    warning = "";
}

I then import keys to the keypool:
bitcoin-cli getdescriptorinfo "wpkh(tpubDFLL8VNUhpLNVLw8179WCEuMZtKtTDd7EeYeFDtThzisj6wfJ4Zi43qUvCE7ciCFxVKZYssRr9P9PerLefkVEjKL6CphUvbGv1CrSCS2KUB/*)"

responseString = {

  "descriptor": "wpkh(tpubDFLL8VNUhpLNVLw8179WCEuMZtKtTDd7EeYeFDtThzisj6wfJ4Zi43qUvCE7ciCFxVKZYssRr9P9PerLefkVEjKL6CphUvbGv1CrSCS2KUB/*)#udrnh6f5",
  "isrange": true,
  "issolvable": true,
  "hasprivatekeys": false

}

bitcoin-cli -rpcwallet=ColdWallet importmulti '[{ "desc": "wpkh(tpubDFLL8VNUhpLNVLw8179WCEuMZtKtTDd7EeYeFDtThzisj6wfJ4Zi43qUvCE7ciCFxVKZYssRr9P9PerLefkVEjKL6CphUvbGv1CrSCS2KUB/*)#udrnh6f5", "timestamp": "now", "range": [0, 99], "watchonly": true, "label": "Fully Noded Cold Storage", "keypool": true, "internal": false, "rescan": false }]'

result = (
        {
        success = 1;
    }
)

I then set keypool to false and internal to true:
bitcoin-cli -rpcwallet=ColdWallet importmulti '[{ "desc": "wpkh(tpubDFLL8VNUhpLNVLw8179WCEuMZtKtTDd7EeYeFDtThzisj6wfJ4Zi43qUvCE7ciCFxVKZYssRr9P9PerLefkVEjKL6CphUvbGv1CrSCS2KUB/*)#udrnh6f5", "timestamp": "now", "range": [100, 199], "watchonly": true, "keypool": false, "internal": true, "rescan": false }]'

result = (
        {
        success = 1;
    }
)

I can use getnewaddress -rpcwallet=ColdWallet without issue but if I try:
curl --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "walletcreatefundedpsbt", "params":[[],[{"mxV3ojsAHKuYHoDVqYczs6iPAfCCYESEDc":0.0001}]] }' -H 'content-type: text/plain;' http://user:password@127.0.0.1:18332/wallet/ColdWallet

result = {

    error =     {
        code = "-4";
        message = "Can't generate a change-address key. No keys in the internal keypool and can't generate any keys.";
    };
    id = curltest;
    result = "<null>";

}

Furthermore calling bitcoin-cli rpcwallet=ColdWallet getwalletinfo
returns:
{
  "walletname": "ColdWallet",
  "walletversion": 169900,
  "balance": 0.00000000,
  "unconfirmed_balance": 0.00000000,
  "immature_balance": 0.00000000,
  "txcount": 1,
  "keypoololdest": 1561077339,
  "keypoolsize": 98,
  "keypoolsize_hd_internal": 0,
  "paytxfee": 0.00000000,
  "private_keys_enabled": false
}

Is this a bug? Or am I doing something wrong?
I am using Bitcoin Core as a back end for an app I am developing and want the user to easily be able to create cold transactions using the keys they import into the wallet without having to specify a change address every time.

I then set keypool to false and internal to true:

This is what you are doing wrong.
Bitcoin Core has a separate change keypool. By not setting keypool to true, the imported pubkeys won't be added to the change keypool.

Thank you, for some reason I thought the two were mutually exclusive. Just found your gist on how to use bitcoin core with a hardware wallet, it is exactly what I have been looking for. For anyone else here is the link: https://gist.github.com/achow101/a9cf757d45df56753fae9d65db4d6e1d


text:
How to create a double spend to prioritize a new transaction over a previous unconfirmed transaction?
I'd like to generate a double spend transaction and increase the gas fees over the previous, unconfirmed transaction that has been stuck for a week. I know there's other answers regarding double spend but I'm looking for more of a technical answer specific to my thought process and sample code.
I understand the general premise is to recreate the originating transaction in its entirety. I've started by utilizing bitcore-lib to perform a getRawTransaction of my currently stuck transaction. From here, I'm iterating over the vin and performing a getRawTransaction of the vin's txid to retrieve the parent. I'm then parsing the parent, iterating over each vout and looking for vout.n to match the previous vin.vout. Once I find a match, I'm generating a utxo which effectively looks like this:
const utxo = {
    address: output.scriptPubKey.addresses[0],
    txId: vin.txid,
    outputIndex: vin.vout,
    script: output.scriptPubKey,
    satoshis: output.value
};

I then use these utxos to generate and sign the transaction as follows (sorry for lack of full class, but the actual process of signing transactions is fully functional):
const transaction = new Bitcore.Transaction();

transaction.fee(this.fee());
transaction.from(utxos);
targets.forEach((target) => {
    transaction.to(target.address, this.amountToSatoshis(target.amount));
});
transaction.change(address);
transaction.sign(this.privateKey(privateKey));

So my questions are...

Is my thought process correct in how I could go about regenerating the original transaction for submission by bitcore?
Is there an easier way to regenerate the transaction and increase the fees than how I'm trying to do it?
When attempting to replicate/duplicate the previous utxos, would I want to also provide the sequence number in the utxo?
Will this even work or will I even be able to submit this transaction to my same core node?
If it won't work, would it work if I ran -zapwallettxes on the core node first?

You are probably better off just doing a Child Pays For Parent transaction, assuming there was a change output and/or you are the recipient.

In this scenario, I am the sender wishing to increase the gas fees of my sent transaction @m1xolyd1an. It's currently being sent to an exchange address I don't control.


text:
Help to recover BTC
In 2013 i purchased some BTC. From the guy that sold me i have recieved some text and password. The text has 76 signs. Starts with AAQ and has + sign. Also has upper and lower case letters and numbers and 12 charecters pass.The instructions that I remember were: go to bitcoinadress.org and there copy adress and key which have balance 0 then use pywallet to create wallet.dat file and insert it to bitcoin core wallet. But I cant rememer what to do with recieved text.I had instructions but deleted form HDD. Can somebody help me what I need to do.
Thanks
Regards

Does this answer your question? Convert Base64 Private Key to WIF. Alphanumeric text with '/' and '+' characters is usually Base64

It seems you have a BIP38 encrypted Private Key, you cloud try:
1 - go to https://www.bitaddress.org/
2 - go to "Wallet Details"
3 - paste the text you have in "Enter Private Key"
4 - click on "View Details"
5 - paste your 12 characters pass in "Enter BIP38 Passphrase"
6 - click on "Decrypt BIP38"
If everything goes well, you should be able to see your Bitcoin Address and your Private Key Wif, then you will be able to import this private key in some wallet software and spend your bitcoins.

I thought BIP38 was Base58 encoded. Doesn't that mean that BIP38 keys should start with a "6" not with an "A", be 58 characters long not 76 and not include "+" signs?

yes it should be, but as he said he received those instructions, I think it is worth try to see if he can decrypt the text he has using that bitaddress procedure.


text:
Bitly core website not loading
I misplaced my previous laptop, and I got a new one, I downloaded my wallet from Bitly core using my 18 word passphrase, I have been loading the nodes and it got stuck on 87%, I tried visiting the website, and it looks like it has been deleted, I've got about 5BTC there, please help me..

Sorry to break that to you, but I looked at that site a few days ago when another person asked about Bitly Core. All the links to developer resources and source code were either lifted from Bitcoin.org or just placeholders. I'm pretty sure that it was a scam and not a legit wallet.

Does this answer your question? Bitswallet core or Please, I need help about Bitlycore.com


text:
Error validating a transaction with blockcypher
I've created a testnet transaction using blockcypher API (https://api.blockcypher.com/v1/btc/test3/txs/new) and then signed the transaction using the signer (go lang). And then sent signed transaction to blockcypher (https://api.blockcypher.com/v1/btc/test3/txs/send)
But it's returning error:
Error validating generated transaction: Error running script for input 0 referencing e41a5ceca53f2cd6076f3a100137d6182d0bd567d91e508f4171712b9c67f429 at 0: Script was NOT verified successfully.

The response I'm receiving:
{
  "errors": [
    {
      "error": "Error validating generated transaction: Error running script for input 0 referencing e41a5ceca53f2cd6076f3a100137d6182d0bd567d91e508f4171712b9c67f429 at 0: Script was NOT verified successfully."
    }
  ],
  "tx": {
    "block_height": -1,
    "block_index": -1,
    "hash": "c514900d8ed184c37bd795c30f24d56508c40ca5f65c2bf8d724162fd8976353",
    "addresses": [
      "tb1qy0jm6vmy2vmndpzzj34z6h6xnelta98d0ukf6s",
      "tb1qwchaysp9wfukq54yee8uye20f2c5zkpl97elvx"
    ],
    "total": 3996400,
    "fees": 3600,
    "size": 222,
    "vsize": 141,
    "preference": "low",
    "relayed_by": "2a01:4f8:192:6027::2",
    "received": "2021-05-01T09:34:02.926591638Z",
    "ver": 1,
    "double_spend": false,
    "vin_sz": 1,
    "vout_sz": 2,
    "confirmations": 0,
    "inputs": [
      {
        "prev_hash": "e41a5ceca53f2cd6076f3a100137d6182d0bd567d91e508f4171712b9c67f429",
        "output_index": 0,
        "output_value": 4000000,
        "sequence": 4294967295,
        "addresses": [
          "tb1qwchaysp9wfukq54yee8uye20f2c5zkpl97elvx"
        ],
        "script_type": "pay-to-witness-pubkey-hash",
        "age": 1973087,
        "witness": [
          "3045022100a4a53cc0eaae807e5c3500af2132a8e575823fc0ff7ceb92de94b739920810ba0220339aa4128967654977b6afb8be9a8897c5e822e2cb5659fe987c106bec44101e",
          "03f2cfd459014d4f19f36e28dcae329ca4f6b263d4d7c13ca7317a75b1a130f0f6"
        ]
      }
    ],
    "outputs": [
      {
        "value": 2000000,
        "script": "001423e5bd33645337368442946a2d5f469e7ebe94ed",
        "addresses": [
          "tb1qy0jm6vmy2vmndpzzj34z6h6xnelta98d0ukf6s"
        ],
        "script_type": "pay-to-witness-pubkey-hash"
      },
      {
        "value": 1996400,
        "script": "0014762fd2402572796052a4ce4fc2654f4ab141583f",
        "addresses": [
          "tb1qwchaysp9wfukq54yee8uye20f2c5zkpl97elvx"
        ],
        "script_type": "pay-to-witness-pubkey-hash"
      }
    ]
  },
  "tosign": [
    ""
  ]
}

Any help would be greatly appreciated. Thank you all.

It seems that there is no sighash type at the end of the signature data in witness.

Thank you for showing me the right direction. I've just missed that I have to add a flag (01) at the end of the signature for P2WPKH. Though blockcypher API documentation is missing that part or maybe hidden somewhere.

I have a similar problem, so I am posting my question here, hoping somebody can come to the rescue. I am not a coder, just a simple user of a hardware wallet (Ledger Nano S) , that has served me well for a year or so. Since a couple of days however, I have the isse that Litecoin transactions are not going through. For days they are stuck. On the Blockchair Explorer I see "Transaction status: Waiting for confirmations 0 of 24 Queue: 89 of 93 Est. time to 1 confirmation:  in 2 minutes". The Queue message changes all the time, but there is never a single confirmation. After I had this with the first transaction I tried it with a couple of other ones, and those are stuck as well. Another observation is that some of the transactions are recognized by one blockchain explorer, eg Blockchair, but not by another, eg Blockcypher. I read that you can "unstuck"a non-confirmed transaction by connecing your HW wallet to Electrum and then re-broadcast the transaction with a higher fee. But these recent transactions did not show up in the Electrum history. So there you have it, I am stuck in limbo. If someone can help me, that would be much appreciated.