text:
Non SegWit P2SH bytes structure
I'm working on a bitcoin block explorer in golang, in which I'd like to gather as much informations as possible about transactions.
I am able to extract addresses from every type of output, and mostly every type of input, except I am struggling to find clear P2SH documentation.
BIP16 doesn't say much about non-SegWit P2SH byte structure. I read many examples where OP_0 is the first byte, as opposed to P2WPKH in P2SH and P2WSH in P2SH where the first field is scriptSig's total length followed by 0x0/OP_0.
From what I understand, a non-SegWit P2PH address is obtained by hashing the redeem script, but I'd need something to anchor to, like for example 1st byte is OP_0, then comes the size of the data (probably a signature), loop until finding OP_TRUE followed by OP_PUSHDATA1?
But is this the unique, standard format?

A P2SH locking script on an output has the following structure:
         Output (scriptPubKey)
--------------------------------
OP_HASH160 <scripthash> OP_EQUAL

The address comes for this comes from the <scripthash>, creating a "3address". This is the standard format for a P2SH, so you can identify it and work out the address from there.
That's all you need to get the address, but explaining a little further...

Interestingly, the <scripthash> can be the hash of any kind of script you like. However, it's most commonly used for putting the hash of a P2MS in there. So when you come to unlock this script, the scriptSig may look something like this:
          Input (scriptSig)
-------------------------------------------
OP_0 <signature> <signature> <redeemscript>

What you're seeing here is basically a complete script for what would have been a classic P2MS scriptPubKey and scriptSig, where the <redeemscript> is a data push of a normal script with opcodes.
          Input (scriptSig)
-------------------------------------------
              scriptSig       scriptPubKey (as a data push)
---------------------------- --------------
OP_0 <signature> <signature> <redeemscript>

With P2SH it's like you have a complete scriptSig+scriptPubKey contained inside the scriptSig, and it can contain any script so it doesn't have a standard form.
Anyway, this complete P2MS script starts with a OP_O, because all P2MS scriptSigs have to start with that due to the off-by-one bug that the OP_CHECKMULTISIG opcode. This is nothing to do with the OP_0 you get in Segwit scriptPubKeys.
When this script executes, the <redeemscript> will firstly be hashed and compared with the <scripthash> in the output to make sure it matches. If it does, the <redeemscript> is deserialized to see the opcodes:
      Input (scriptSig)
-------------------------------------------
              scriptSig       scriptPubKey
---------------------------- --------------
OP_0 <signature> <signature> OP_2 <pubkey> <pubkey> <pubkey> OP_3 OP_CHECKMULTISIG

So this is what you would see on a classic P2MS output, but this just happened to be wrapped in a P2SH script because it's cheaper for the sender. So this is the standard format for a P2MS: (OP_N <pubkeys...> OP_M OP_CHECKMULTISIG).
This particular scriptPubKey does not actually have an address. There are <pubkeys> in there, but it wouldn't be technically correct to say those <pubkeys> have an "address", because an address refers to a specific locking script pattern, and is not just the friendlier version of any <pubkey>.
Examples:

P2SH with a P2MS inside it: https://learnmeabitcoin.com/explorer/transaction/d3adb18d5e118bb856fbea4b1af936602454b44a98fc6c823aedc858b491fc13/output/0#scriptPubKey
P2SH with a non-standard script inside it: https://learnmeabitcoin.com/explorer/transaction/7d46745463a28049cb93d2c964320912d9c296c1038cb24cc3716255c397a87f/output/1#scriptPubKey

Links:

https://learnmeabitcoin.com/guide/p2sh
https://learnmeabitcoin.com/guide/p2ms
https://learnmeabitcoin.com/guide/address

Thank you for this great answer! One puzzle piece is missing for me: How does the validator decide where the redeem script starts so that it can hash it?

The  is the last item in the scriptSig (it's actually a data push and not individual opcodes), so you can just look at that last item.

Ok, I repeat to see if I understood it:
So the the  is pushed bytecode. So it's on top of the stack when the  has been executed (pushes only). So by convention we interpret the top stack element as Bitcoin Script and load it into a new script stack for execution if the corresponding UXTO was a P2SH?

@schmijos Yes that's correct.

From what I understand, a non-SegWit P2PH address is obtained by hashing the redeem script

ScriptPubKey
I had the same problem and I have resolved it with this C++ code, and I think this code is self-describing.
If you have the ScriptPubKey extract from the blk file, this is code calculate the correct address P2SH.
string opcode = hex.substr(0, 2);
int32_t optValue = std::stoul(opcode, nullptr, 16);
auto optMap = bitcoinOpCode.opCodeList.find(optValue);
string optCode = optMap->second;
if (optCode == "OP_HASH160") {
 cout << "Finded the P2SH";
 string scriptHash = hex.substr(4, hex.length() - 6);
 Bytes bytes = hexBytes(scriptHash.c_str());
 bytes.insert(bytes.begin(), 1, 5);

 string address = EncodeBase58Check(bytes);
 cout << "P2SH addresss is " << address;
 string endOpCode = hex.substr(hex.length() - 2, 2);
 int32_t optValueEnd = std::stoul(endOpCode, nullptr, 16);
 auto optMapEnd = bitcoinOpCode.opCodeList.find(optValueEnd);
 string optCodeEnd = optMapEnd->second;
 if(optCodeEnd == "OP_EQUAL"){
   cout << "\n\t----------------------------------------| Results |-----------------------------------" << endl;
   cout << "\t                               ###  Script PUB KEY HASH  ###                            " << endl;
   cout << "\t" << optCode << " "  << scriptHash << " " << optCodeEnd << endl;
   cout << "\t                                                                                " << endl;
   cout << "\t The public key: " << address << "                                   " << endl;
   cout << endl;
   cout << "\t https://blockstream.info/address/" << address << endl;
   cout << "\t______________________________________________________________________________________"<< endl;
  }
}

how I do calculate the correct address?
You know the complete P2SH, an example this
OP_0 <A Signature> <B Signature> OP_2 <Public key A> <Public key B>
<Public key C> OP_3 OP_CHECKMULTISIG
OP_HASH160 <ScriptSig Hash> OP_EQUAL

Inside the this code you can find the scriptSig, so this:
OP_0 <A Signature> <B Signature> OP_2 <Public key A> <Public key B>
<Public key C> OP_3 OP_CHECKMULTISIG

and the ScriptPubKey, so this:
OP_HASH160 <ScriptSig Hash> OP_EQUAL

With my code, I work only with the scriptPubKey and I found the dimension with the following mode
OP_HASH160 = hex.substr(0, 2);
<ScriptSig Hash> = hex.substr(4, hex.length() - 6);
OP_EQUAL = hex.substr(hex.length() - 2, 2);

on the data hex <ScriptSig Hash> I can run the EncodeBase58Check encoding, I have to change the code of bitcoin core(this) for change the hash library.
Inside the bitcoin core code you can find the correct execution of EncodeBase58 (here)
Another important code is this to insert the mainet flag inside the byte.
bytes.insert(bytes.begin(), 1, 5);

ScriptSig
The scriptSig inside is composed to two component, so:

the Sighnature: OP_0 <A Signature> <B Signature>
the program control: OP_2 <Public key A> <Public key B>
   <Public key C> OP_3 OP_CHECKMULTISIG

I didn't have to try to decode with code the script sig but I think this is more difficult to others because the dimension is not standard because the program control is a script P2MS and this script has more combination.
I can suggest you create a decompiler intelligent for scriptSig because if you get the OP_2 hex inside the script you can read 2 signature but it is possible to get the OP_14 and your parser must be read 14 signature.
I can suggest you to start decompiler the ScriptSig to end because you know the dimension end hexadecimal.
When you have extracted the pubkey and if you want an address bitcoin you can read my question here

Thanks a lot for the detailed algorithm explanation, but my question was more about the standard ScriptSig follows, creating a loop that extracts the redeem script is not hard, yet I must be sure the format is always of the form:
<OP_0><{data1 size}{data1}><{data2 size}{data2}>...<OP_1>

@iMil No because the signature depends on the combination of P2MS script, I have mentioned this argument in the ScriptSig section.


text:
30 months of history, and 50GB of data?
I had installed bitcoin-wallet app on an old phone a couple of years ago, just out of curiosity about bitcoin.
I obtained somehow a teeny amount of bitcoin, .0017xxxx
anyway, I installed the app on a new phone, and exported/imported.
This all worked fine.
I am just curious about what then happened...
on the new one after the import, it initially said something to the effect of
"recreating (resyncing?) 30 months of history" or something.
And very very slowly the number of months went down and eventually got done, taking maybe a day.
I did notice the phone was pretty warm :-)
Afterward, I had to chuckle because I just happened to notice the phone said it had used 50GB of data that day (!)
Is that all normal? What was it doing all that time? Is it necessary?

Exactly which app are you talking about?

this is the app: https://play.google.com/store/apps/details?id=de.schildbach.wallet

Most mobile wallets are light-clients, meaning they don't download and validate the entire blockchain history. Instead, they just download the block headers (80 bytes per block), and then request any additionally needed block/transaction data that is related to the addresses that the wallet controls.
At the time of writing, the network is currently at blockheight ~623,000, so we should expect a light client to download about this much data:
623000 blocks * (80 bytes / block) = 49,840,000 bytes = ~50 Mb
The actual amount will likely be slightly higher, but we can get an idea for the order of magnitude of data from this estimate.
So, assuming that this wallet is just a light-client, it is odd that it would download 50 Gb of data. If this is the app you are mentioning, the recent user reviews make it sound like this excessive data usage is a bug (see the dev responses on that page).

thanks, yes, that is the particular app... now that you mention it i see this user reported using 6GB unexpectedly https://play.google.com/store/apps/details?id=de.schildbach.wallet&hl=en_US&showAllReviews=true

source: Stack Exchange

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

sort: votes


text:
I need a few lines of python to make WIF addresses
I have code which generates WIF keys from hex keys.  It just need a few more lines to generate WIF addresses.
------------------------

import binascii, hashlib, base58, sys
def convert(z):
private_key_static = z

extended_key = "80"+private_key_static+"01"

first_sha256 = hashlib.sha256(binascii.unhexlify(extended_key)).hexdigest()

second_sha256 = hashlib.sha256(binascii.unhexlify(first_sha256)).hexdigest()

final_key = extended_key+second_sha256[:8]

WIF = base58.b58encode(binascii.unhexlify(final_key)).decode ('ascii')

print (WIF)

with open("HEX.txt") as file:
    for line in file:
       convert(str.strip(line))

Note: WIF is a format for private keys, not addresses.  There are multiple address formats, but the most common is P2PKH (hash of a public key).
I recommend looking that the code for Electrum to learn about how to work with public keys and addresses in Python, (check out bitcoin.py).  It contains everything you need and is reliable code used by many thousands of users to secure their bitcoin.

TY  You're right.  I'm a beginner at this.

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


text:
How to get access to funds on keys that were derived using public key child derivation? BIP 32
If I have a key m/0'/0' and I'm using CKDpub to derive m/0'/0'/0 and then CKDPub to get m/0'/0'/0/0. How do I get access to the funds on the addresses generated by CKDPub?
Can m/0'/0' ->  CKDPriv -> CKDPriv => m/0'/0'/0/0 key use those funds?
Another way: if I take a private/public key pair, use CKDPub on the public and CKDPriv on the private, do they yield the same public keys?

if I take a private/public key pair, use CKDPub on the public and CKDPriv on the private, do they yield the same public keys?

For unhardened childs, yes.


text:
What if periodic redistribution of bitcoin had been built in the protocol/wallets?
Imagine if there was a Bitcoin-like currency that had periodic wealth redistribution built in the protocol. For example, every month you and every other wallet would pay 20% of their bitcoin evenly to everybody else.
I know the idea has a lot of technical challenges/flaws, but on principle what do you think of the idea? Would it incentivize more transactions and economic activity?
Early miners/users own most of the bitcoin supply and there is not much incentive for normies to get involved because a small number of whales are controlling the network and there is no way to get access to meaningful sums of bitcoin.
It's just an idea -- what do you think?

For example, every month you and every other wallet would pay 20% of their bitcoin evenly to everybody else.

There is a technical issue with this, and a social issue:
Technical: How is it decided where the 20% gets paid to? How do we determine that each actual human being is being paid, and only being paid once? If you agree to centralize the control of this function, it isn't too tough: everyone just registers their identity with the central authority, so that the central authority is solely responsible for ensuring all payments are accurately made.
Of course, this is entirely antithetical to the design of bitcoin: there is no such hierarchy or position of authority in the network. Without the central authority, there is an obvious issue: a single human could just register many different address/devices/IP addresses/etc, to gain more than their 'fair share' of the redistribution**. This is a fundamental problem for decentalized systems, it is not trivial to solve.
Social: It will likely be difficult to convince people to opt into a system wherein they may lose up to 20% of their net worth every month. I think you can set this tax to whatever level and frequency you'd like, but it won't change the situation much.
The function of such a system would depend on the altruistic participation of the wealthy. This is not a stable proposition, we should expect that a wealthy and rational actor may not opt in to such a system, given the choice.

Would it incentivize more transactions and economic activity?

It would incentivize moving your wealth into a different financial instrument/money.
These two ideas, bitcoin and wealth re-distribution, are inherently incompatible. Bitcoin is entirely opt-in, whereas for wealth redistribution to really work, you need a system which does not allow the users to opt-out.

**Interestingly, bitcoin mining is itself a solution to this problem: users that want to gain the reward must prove that they have spent energy securing the network to do so. There is no way to fake the energy, and spending more energy does not win you a disproportionate amount of the reward. Bitcoin mining is a probabilistic solution to this problem of sybil-attacking the network: the attacker can no longer fake being a large number of nodes on the network, they must spend real resources to participate.


text:
Lightning network without main chain?
I've been reading about the working of LN. I had this interesting thought, what if we dont need the main blockchain and the miners to have a p2p cash system. Let me explain.
The difference between the current LN and what I thought is, people have channels only with the people they know and trust. There wont be any multisig wallet(may be set a limit for each channel based on their trust of the other person). And when they wanna close the channel, they transact in real life either with bitcoin or fiat (whatever unit they are using). Since it the people they trust there wont be any cheating problem.
This will be a completely p2p system. Would such system work? Am I missing anything?

You've basically described Ripple (aka XRP). You may want to read up on it - and specifically, criticism of it that can help illuminate why this system does not offer the same benefits that Bitcoin's does.

The difference between ripple and this would be, ripple need a validating node and this is completely only peers

I think the system described by OP much more closely resembles the old pre-XRP Ripple system by Ryan Fugger.

As Meni and Pieter have pointed out, you seem to be describing the original Ripple system (described and centrally implemented before the Ripple/XRP company, and even before Bitcoin).
One main point that hasn't been mentioned before is that this system isn't based on a bearer asset like Bitcoin but on debt instead. So it would be a F2F (friend-to-friend) debt channel network instead of a P2P cash channel network like Lightning is.
This has many implications that probably prevent such a system from scaling widely. For example, it would be hard for large companies to be part of such a system since they would need to trust all their customers.
I'm not saying that it couldn't work, but it would be a system with very different properties and there is probably a reason why it hasn't taken off long before Bitcoin.

Under the given assumptions such a system would work. However I highly doubt the assumptions


text:
Why bitcoin is not full p2p?
The goal of bitcoin is to serve as p2p electronic cash. But it still needs a 3rd party (miners) to approve/authorize/record/track/store transactions. The difference is this authority is decentralized and distributed.
Why is it not a complete p2p (like gold, fiat cash) electronic cash? Is it not possible to create such system with cryptography? If yes what are the difficulties?

it still needs a 3rd party (miners) to approve/authorize/record/track/store transactions

Role of miners vs other participants
In the beginning miners were not a third-party, every wallet owner was also a miner, all peers performed the same roles.
Nowadays mining has become a separate activity but miners do not really have any special control over the bitcoin network. They have a specialized role but I believe their influence over consensus rules carries the same weight as ordinary wallet nodes. Its just that a mining business deploys a lot more nodes than the average wallet owner does. In any peer-to-peer system, even a completely homogenous one, one person or organisation could deploy a large number of nodes.
approve/authorize/record/track/store transactions
approval
All nodes approve transactions, if all ordinary wallets disapprove of blocks from a miner then that miner loses money.
authorisation
There is no authorisation in the Bitcoin network protocols or consensus rules so far as I know.
The only action similar to authorisation is the P2P process of proving ownership of private keys in order to prove the right to spend the outputs of a transaction. Every wallet does this.
Recording transactions
Miners are responsible for recording transactions in the blockchain. So they do have a special role here. Bitcoin relies on no single organisation having more than 50% of the total available hashing power.
Tracking transactions
All full-nodes track transactions (i.e. keep local records of transactions in blockchain blocks as well as maintain an in-memory pool of unconfirmed transactions). Miners have no special role here.
Storing transactions
All full-nodes store a complete list of transactions from which blocks of fully-spent transactions are optionally pruned. Miners have no special role here.

Why is it not a complete p2p (like gold, fiat cash) electronic cash?

Gold is not P2P in the modern world. Generally people who buy and sell gold directly do so in the form of coins or ingots - the production of coins and ingots is performed by a limited number of businesses not by the buyers and sellers. Often it is governments that mint gold coins. Often governments regulate the gold market. Gold assayers are often relied on by buyers.
Fiat cash is not P2P. Banknotes and coins are typically created by governments, not by buyers and sellers. The amount of fiat cash in circulation is typically managed by governments. Inflation rates are set at the whim of politicians.

Regarding the gold and fiat cash, I meant from the transaction perspective its a complete p2p. No 3rd party needed for a transaction. And also with gold I had the history in my mind, like in the old days the merchants used gold to trade stuff.

And also the top 10 or 20 mining pools combined have more than 50% of the hashrate of the network which is scary to me. Any thoughts on this?

@Mani: Your question is whether Bitcoin is "Full P2P". This Q&A website is different from a discussion forum, new questions should be asked separately and comments are temporary and disposable - they are intended to suggest improvements to questions/answers or to request clarification of points that are unclear. Don't forget to try the search facility for questions such as 51%

The existing answer is very good, but I think it does not answer this part of your question:

Is it not possible to create such system with cryptography? If yes what are the difficulties?

Indeed, because the problem isn't one related to cryptography, but physics.
Imagine, in a hypothetical miner-less P2P currency system with all the properties you hope for, that one person creates two transactions that spend the same money twice. The system needs something or someone to determine which of these is accepted, and which one isn't. My understanding of what you're asking for is that it isn't someone - instead, there should be some global, fair, mechanism that makes this determination.
The obvious criterion to use is time: the first of the two wins. Unfortunately, and counter to many people's intuition, there is no such thing as a objective global ordering of events in a distributed system.
Say someone creates two conflicting but otherwise legal transactions (where each individually would be valid if the other was absent), and sends this transaction to two nodes in the network, one in Australia, and one in North America, simultaneously. It's surprising, but these two peers literally have no way to determine which of them saw the transaction first, due to the fact that communication between them takes a non-zero amount of time. The Australia one will think it was first, and the North America one will think it was first, and nothing one can tell the other to prove them wrong. In short: each machine has its own local clock, and order events as they see it, but there is no global clock.
Thus, time cannot be used to determine which of two conflicting transactions is valid. Perhaps another mechanism can, but it's hard to imagine what that would be.

But it still needs a 3rd party (miners) to approve/authorize/record/track/store transactions. The difference is this authority is decentralized and distributed.

I would say this is not quite correct; miners do not really have 'authority' over the network, at least not in the ways that term would usually infer.
When a transaction is submitted to the network, the miners that hear about it will in pretty much every case have no idea where it came from, so the ability to selectively censor is extremely low. This doesn't mean that miners can't arbitrarily censor transactions, but doing so would mean lost opportunity cost - and that is a big deal in a hyper-competitive industry with slim margins! Since mining is permission-less to join, we should expect that if miners are arbitrarily censoring transactions and losing revenue because of it, eventually some other miner will come online to grab the profits that the other miners have ignored.
These incentives remove any sort of 'authority' an individual miner could have over the network. Thus collectively, miners are not an 'authority' in any meaningful sense of the word.
A majority attack breaks these assumptions, but it is incredibly expensive, difficult, and counter-productive to launch such an attack.

Why is it not a complete p2p (like gold, fiat cash) electronic cash? Is it not possible to create such system with cryptography? If yes what are the difficulties?

In the physical world, it is fairly easy to imagine how a P2P cash system would work: you just trade physical items, that represent some amount of value. When someone hands you the item, you can inspect it to ensure it is authentic.
But in the digital world, this problem gets really tough. It is very easy to copy/paste a digital file, so if I had a file that said This is worth $10!, I could just copy it 100 times, to create $1000 in value. So if someone paid you using one of these files, how could you know whether or not it was a copy?
The obvious solution is to create some sort of central authority, which keeps track of the balance of individual users. But this existence of a central authority is a security risk to users, so it doesn't look like a great fix. The general formalization of this problem is called the Byzantine General's Problem, and it was an unsolved question in computer science for a long time.
So we might imagine that we could just create a ledger that includes all transactions: everyone will watch the ledger, and update it as transactions are made. But there is still a problem! How will everyone agree upon the ordering of transactions? What if a user sends two payments using the same money, at the same time? Even in the case that everyone is acting honestly (unlikely), network latency alone could cause issues. Notice that the issue here is transaction ordering, we are in need of some sort of chronology for transactions. So how do we keep everyone in sync, running on the same clock and thus able to agree on the ordering of transactions?
Well, one day back in 2009 Bitcoin was released to the world, and offered a probabilistic solution to the problem! By forcing miners to spend a real-world resource in order to progress the network, we arrive at a solution that creates a sort of 'clock' to record when transactions happen. You can imagine each new block as a 'tick' of the clock, in a simple sense.
And so in Bitcoin, everyone has the ledger, and they can all agree on the ordering of transactions on it. Miners are necessary for this ordering to take place, but are otherwise not in any special position of power on the network. Without mining, it is unclear how we would accomplish creating this chronological ordering in a decentralized manner.

All of that said, you may be interested to learn more about the Lightning Network. While the lightning network is still built upon on-chain bitcoin transactions, each individual lightning network payment can be completed in a purely P2P fashion. No information needs to be broadcast to anyone other than the relevant channel participants, so payments can be completed in a very private manner.


text:
Is it possible to change private key
I would like to know if it's possible to change private key of bitcoin wallet via rpc call to bitcoind.
Thank you for your answers

Which key do you want to change? A wallet stores your private keys of your UTXOs. You could change your private key, if you are able to find a hash collision with another (Private,Public)-Key-Pair that equals the OP_HASH160(Orig_Pub_Key) == OP_HASH160(HASHCOLLISIONPUBKEY).
Hopefully, this is not possible in a finite time...
If it is about your own wallet password, of course you can do that. The only information that is important is your (Pub,Priv)-Keypair. Don't forget that you need the public key too, to unlock your coins!

No, your public key are generated from your private key it cannot be changed.
Private key have one public key and each public key have one adress

I would also add that Bitcoin core uses a list of private keys, so unintentionally private keys vary for privacy


text:
Partial transactions
I am new to cryptocurrencies.
I want to transfer coins to multiple exchanges, how can I do it?
Can I split coins from one wallet into the exchanges?
Do I need a specific kind of wallet?
And when I withdraw coins from an exchange, can I withdraw only a part of my funds(and leave the rest in my exchange account)?

If I understand the question, Yes you can, an example if you buy 100 bitcoin on exchange site x you can send 50 bitcoin to exchange site y. (if the exchange permit it)

I want to transfer coins to multiple exchanges, how can I do it?

Just open accounts on all those exchanges and then get deposit addresses. Transfer funds howefver you like.

Can I split coins from one wallet into the exchanges?

Yes.

Do I need a specific kind of wallet?

You can just withdraw from wherever your coins are now to your deposit addresses at various exchanges.

And when I withdraw coins from an exchange, can I withdraw only a part of my funds(and leave the rest in my exchange account)?

As far as I know, every legitimate exchange supports withdrawals of whatever amounts you want. Typically there are minimum withdrawal amounts and some withdrawal fee to cover the transaction cost, but that's about it.


text:
Unconfirmed transaction. How to make my wallet made whole
I am running a node with an unconfirmed transaction. I tried shutting down my btc qt so the transaction would be forgotten. To no avail it keeps rebroadcasting the transaction. I am in the process of upgrading and syncing my btc qt now too. But it's taking forever to sync. What will happen if I import my keys to a software wallet, electrum? Will my electrum wallet be made whole from the unconfirmed transaction? Any suggestions? I'm not in love with running a node anymore or coinbases ability to retrieve my transaction. Coinbase was the supposed recipient. It's been two weeks.

Possible duplicate of How do I get rid of an unconfirmed transaction on Bitcoin Core 0.14.1?

If you once provided "zapwallettxes" parameter to bitcoin-qt, it would start rescan process, this would be more tricky if you had pruning enabled...

It's possible to make your own node forget the unconfirmed transaction, but the process would be a little complicated: https://en.bitcoin.it/wiki/Fee_bumping#Bitcoin_Core_GUI You would need to temporarily break connectivity. You also have to be sure that the newer transaction is spending same coins with the older transaction, thus the two transactions would conflict with each other. You are still not able to make every node on the network to forget the unconfirmed transaction transaction, that's why you should do such "double-spend".

Should I export my keys to a software wallet, like electrum? How do I actually do the double spend? Can you refer a link or bitchute channel? Or something, lol. It's been two weeks and I'm kind of getting worried about coinbase. That's who the transaction was to. Do you know if they offer any customer service to remedy this?

According to your description (having problems while syncing full node), I wonder if your "unconfirmed transaction" is really unconfirmed? Is it already confirmed, or discarded (due to double-spending etc)?
The first problem: "stuck" 0-confirmation transaction
First of all, replace-by-fee is there to deal with "low-fee stuck transactions" problem, you would be able to bump fee with ease if the transaction had RBF enabled.
If your stuck transaction is not so urgent, you may just wait for the mempool to be cleared naturally, then your transaction will finally be confirmed, since the mempool is not so crowded (like old times in 2017) nowadays.
Just watch the last "Mempool size in MB" chart here: https://core.jochen-hoenicke.de/queue/#24h
If you want to "accelerate" or "revert" this transaction, you have two options.
The first option: you may contact a mining pool which provides "transaction accelerating (prioritising)" service, like Poolin or BTC.COM. However, this option can be expensive, and, there won't be any refund.
The second option: "double-spend" by yourself with Electrum, which is usually much cheaper than transaction prioritising services mentioned above, but a bit complicated.

Find out the previous transaction(s) which the stuck transaction is spending from. You may use the getrawtransaction STUCK_TXID true (replace STUCK_TXID with your own stuck transaction ID) command in debug console of Bitcoin Core, or just query it on an online block explorer like https://blockstream.info.
Blockstream explorer shows previous outpoints clearly, where the outpoint is represented in TXID(long alphanumeric text string):INDEX(number) format. For example: this transaction spent 2 previous transactions, which have TXIDs of 00f5854cebdcd318edd325ab07e4157964f225a659302f3f5949ffe07020db4e and 6d4a34592200324f716a92d8d84db8c85bc97189610b1d4bee4fcb7d56713857

Copy raw transaction data of previous transaction(s). You may simply double-click each transaction showed on Bitcoin Core GUI in turn, to find them by transaction ID, and then right-click -> Copy raw transaction.
You may also use the getrawtransaction PREVIOUS_TXID command instead, you need to run this command separately on each PREVIOUS_TXID, if multiple previous transactions were spent.

Create a new Electrum wallet on an offline device, then choose the Import Bitcoin addresses or private keys option.

Import your private keys to Electrum. The wallet won't sync, because there's no internet - that's fine, because we don't want Electrum to fetch back the stuck transaction.

Import the previous transaction(s) by clicking Tools menu -> Load transaction -> From text.

Click the View menu -> Show Coins to show the Coins tab. Then switch to the Coins tab, select all of them, and right-click -> Spend.
Of course, if you are sure about exactly which coins were spent, you won't need to spend all available coins this time, which could reduce the fee cost a bit - but this situation is relatively rare. To keep yourself from off-by-one human errors, you'd better just spend all of them.

Now, you are about to construct a double-spending transaction which will send these coins back to your own wallet, or any other address(es) you want, by clicking Preview button. This time you should choose a higher fee rate (sat/Byte), at least higher than the stuck transaction.
By the way, it is highly recommended to enable replace-by-fee on this transaction, in case of further fee-bumping.

Electrum is able to show QR code of this double-spending transaction. Use another online device to scan it with Electrum, then it could be sent out. You may also try to send it directly after reconnecting the device to Internet.
If the stuck transaction has not yet expired on the Electrum server you are using, broadcasting the double-spending transaction might face some errors. You may try to broadcast it through other methods, eg. block explorers, and sendrawtransaction of Bitcoin Core.

The second problem: Bitcoin Core full node is painful to sync
First, the performance bottleneck usually lies at frequent I/O operations on the chainstate subdirectory, which stores the UTXO database, especially the data directory was placed on an HDD (which is supposed to make the situation worse if the HDD is SMR).
Second, currently, I'm personally not in favor of pruning, because almost all historical transaction history (which is exactly what the gigantic block chain contains) is discarded, thus rescanning becomes limited within recent blocks only. Rescanning happens if you are importing keys/addresses/wallet.dat, or zapwallettxes. In the future, this problem might be finally relieved by some improvements.
If your computer has plenty of available RAM, you may allocate more than 6GB (depends on historical peak UTXO size) of RAM for the database cache (see the Options window) of Bitcoin Core. This tweak effectively removes the I/O bottleneck. (well, you may still face this problem if you are catching up from some date before, you may cat (Linux/Mac) or type all files (use the * wildcard) into /dev/null (Linux/Mac) or nul (Windows) to force the OS to read them once, then they could be cached into the RAM)
If you have both HDD and SSD, you can configure the blocksdir parameter to migrate the gigantic block chain to a cheap-but-slow HDD, while keeping the frequently-accessed chainstate etc on a fast-but-expensive SSD.

Thank you for your answer. You offer way more than coinbase customer support (who my stuck transaction is to). Is there anything they can do? They barely return my emails. I told them the could debit my account the fee to get the block confirmed. I don't think they even understand what's going on. I'm worried they are going to change my btc coinbase receiving address. It's going on 2 weeks now. At this point I wouldn't recommend coinbase to anyone.

I've done transactions with coinbase before but never had a problem. I'm just so disappointed with there understanding of everything. They are basically turning me into a programmer for one transaction. They should have to give me a job as head of engineering after this. People respond to me on this platform more than coinbase does about my stuck transaction. And they are supposed to be a billion dollar company. Than stack exchange is a trillion dollars company. I've lost faith in even getting this transaction back and am starting to think fiat has its benefits. Coinbase is awful.

I have checked the mempool and block size status just now, it seems that even the transactions which paid the lowest 1sat/Byte fee could already have been confirmed. Is your "unconfirmed transaction" really unconfirmed? If you still have problems with your full node, you may check that "unconfirmed transaction" on an online block explorer.

Pointing fingers at Coinbase or someone else cannot solve the problem. Theoritically, Coinbase could do the "child-pay-for-parent" (Electrum provides this feature directly to both sender and receiver, but it's more expensive than RBF however) trick to bump the fee, thus prioritising the stuck transaction. However, they might have their own wallet management policies which may sacrifice convenience and flexibility in exchange for security.

If coinbase provides a new depositing address to you, this should be totally fine, Coinbase guaranteed that "all addresses that have been generated for your account will remain associated with your account forever" here: https://support.coinbase.com/customer/en/portal/articles/2276500-why-did-my-wallet-address-change-

Blockchain.info doesn't recognize my hash. But my btc qt wallet is still debited. I'm upgrading now. And it's taking forever to sync. I know people don't like me criticizing coinbase but the day before there was no problem. I'm on my 15th day now. No result. No email or correspondence from them to eliviate my concerns or remedy they can offer. So I just want to make it aware to the crypto community about coinbase.

I will provide a bounty for anyone who can remedy this situation for me. I made the same offer to coinbase. No response though. Thank you.

You may lookup your address balance (and related transaction history) on an online block explorer. It sounds harsh, but, I don't think it's impossible - maybe your bitcoin wallet had already been compromised, thus your depositing transaction became an invalid double-spend which was discarded by the network, and, you didn't notice that because your full node had problem to sync.

Once you have confirmed your bitcoins are still on your own addresses, you can simply import the private key to other wallet (like Electrum) to send these coins to anywhere you want.

The day before this fiasco I made a transaction with coinbase. No problem. The next one, nothing. I can't even find the hash on blockchain.info. I am upgrading my node now and is taking forever to sync. It's been more than two weeks. What's the longest time a block sat in the mempool? I still want the transaction to go through. On the dread forum there is already complaints about coinbase. Now the cleaner can know.

Sorry clearnet*

Although most nodes (especially the ones used by mining pools) have a expiration time, there's no guarantee that an unconfirmed (0-conf) transaction will be forgot by every node. As long as the transaction is still valid, it's still possible for someone who didn't discard this transaction to rebroadcast it (or to directly include it in the block, for miners/mining pools).

Recently the mempool usually clears within one day. So, it's quite unusual for me that a transaction could wait for such a long period to confirm. You may copy the raw transaction from Bitcoin Core, then you can rebroadcast it with a block explorer like blockchain.info (or with the sendrawtransaction command). However, to ensure your wallet has not been compromised, you'd better check the balance and transaction history of your previous address on a block explorer. (you may do this with Tor browser to protect your privacy)

It's not possible to remove your transmitted transaction from the network.
Even if you shut down and clean your own local client, other clients around the world have it in their mempool. That's why your local client reflects the balance minus the amount you sent, even though it's not confirmed. That's how it's supposed to work, Bitcoin TX's are supposed to be irreversible even before being mined.
So, Bitcoin does not have a TX revocation network message available.
Only thing you can do is, before this unwanted TX is confirmed, to use another client, which either didn't see your TX or allows you to craft TX's and broadcast them, to submit a new transaction containing a much higher fee and same UTXO's. (Double spending on purpose.)
This new TX will cost you the fee, but if you set your own address as beneficiary, the funds will return to your wallet and the old transaction will get discarded by the network as a double spend. This higher fee is your cost to revoke the old unwanted TX. All this has to be done before the old TX is confirmed in a block.

Do you recommend a client/wallet that won't rebroadcast the tx? I don't want to be too much of a bother but could you refer a link so I can get back my satoshis. Any help would be appreciated. Thanks.

You can use Bitcoin Core itself to create a raw transaction. Then you send the funds to yourself using a bigger fee: https://stackoverflow.com/questions/38493893/heres-how-to-send-raw-transaction-btc-using-bitcoin-cli-command

Blockchain.info doesn't even recognize the hash. Can you explain why?


text:
Imported keys to electrum
I recently had an unconfirmed transaction on my btc qt wallet. I am upgrading my btc qt now and it is syncing. In the meantime I imported my keys from all my receiving addresses to a software wallet. I am still short my whole balance. Can someone explain this to me? Btc qt had X-an unconfirmed transaction. Now I have about X+half my unconfirmed transaction. Any suggestions?

What did you actually import in Electrum? A master privatekey, or a list of private keys?
In the first case, it could be that your gap limit (i.e. the addresses actively monitored by Electrum) is set too low, so it doesn't see some of your UTXOs. You can check this out :
wallet.gap_limit
Then increase the number you will see, for example if it tells you "20" try something like "50"
wallet.change_gap_limit(50)
wallet.storage.write()
Restart Electrum and see if your balance is back.


text:
Blockchain.info explorer doesn't recognize my hash
Blockchain.info doesn't recognize my tx. Can someone explain this. My wallet is debited. The transaction is unconfirmed too.

Doesn't recognize it in what way? Their block explorer doesn't show the transaction? The wallet doesn't show it?

It means your TX never got in the mempool. Are you sure you're not using the testnet?

Why assume blockchain.info is correct.

My wallet is debited. Blockchain.info doesn't recognize the tx id. Not using trestnet. The day before Oct 5th a transaction went through, no problem. I am upgrading my node now, thought that be the problem and it is taking forever to sync. I still want this transaction to go through with coinbase. It's the only reason I'm still keeping my account open. But after this I probably won't use coinbase ever again.

@dave Does your TX show up on blockchain.com now?

No it does not. Why?


text:
Unconfirmed BTC transaction / TXID doesn't exist?
I recently tried sending some btc to coinbase.  In a hurry I did not put a transaction fee.  I've tried to explain to their customer support what is going on.  I offered to charge me a fee through my wallet on coinbase to do a pay for parent protocol. Their lack of understanding is making me worry.  I tried using ViaBTC.  I put in the transaction ID and they said the TXID did not exist.  Any suggestions would be appreciated.  Its approaching 7 days now.  Thank you.

Did you literally set a fee of zero?  Such transactions are normally not relayed, so it would be normal if coinbase never saw it.  If you can tell your wallet software to just forget the transaction, then you can simply create a new one (spending the same inputs) that does have a fee.

how do i resend with the same inputs?  I am using bitcoin qt 4.8.3. It has been 7 days now.  Not confirmed.  I mentioned cpfp and asked them to bill my account accordingly, I don't think they even understand what I am talking about.  Its all pre programmed email responses.  I am worried coinbase is going to change my coinbase btc wallet address.  This is my second btc transaction with them and my second coinbase btc wallet address.  I think thats how messed up they are.  Any suggestions?

See https://bitcoin.stackexchange.com/questions/9046/why-is-my-transaction-not-getting-confirmed-and-what-can-i-do-about-it.  Note that 4.8.3 is incredibly ancient and it would be wise to upgrade.  It is not a problem if they change your wallet address, this is normal and desirable. Just use the new one for the destination of the new transaction.

so just resend it?  What happens to the original transaction?  Will my btc qt wallet be credited from the original transaction?

As far as the blockchain is concerned, the original transaction never existed and the funds never left your wallet.  You just have to convince your own wallet to forget about the original transaction as well, so that it has the same view as the rest of the world.  Then you can create a new transaction.  It's good to make sure that the inputs of the original transaction are spent, to avoid any possibility of some attacker resurrecting the original transaction in the future - as mentioned in the linked answer, this can be done by simply sending your entire balance to yourself.

so i would have to send my entire balance plus the original transaction to myself (the same bitcoin qt wallet) and that would credit my bitcoin qt wallet?  Will it allow me too?

I'm really upset with coinbase at this point.  They are supposed to be this major corporation.  They don't have a mining rig in their engineering department?  Or they don't offer cpfp?  I might not be the brightest bulb in the chandelier but I know you get better results on market places on the dark web.  Mark Andreesen and Horowitz should be ashamed of themselves.  I could have gotten better results from a kid in his mother's basement in the third world than this multi million dollar company in the west (so they claim). Smh

I don't believe CPFP is even possible with a zero-fee transaction.  The parent will never be relayed, so miners won't ever see it, and they can't confirm the child without it, no matter how high the fee is.  And having "a mining rig" isn't sufficient to get a transaction confirmed, not unless you want to wait an indefinite amount of time.  Anyway, I get that you're upset, but the comments thread here should be kept relevant to the technical question at hand, not for general venting.

If you zap transactions and rescan as explained in the other question I linked above, then your wallet will not know anything about the original transaction ever having existed.  You will see the same balance you had before you sent it.  At that point, you can generate a new address with your wallet and send your entire balance there (with a fee!) - that will ensure the original transaction can never confirm.  Then you can finally send funds to coinbase (using a current deposit address) or wherever else you please.

I understand, just want to let the community know of that coinbase's customer support is basically outsourced to stackexchange.  Could you help me though?  I am trying to get my bitcoin qt 4.8.3 wallet/node back to whole.  It is still debited that unconfirmed transaction.  What should I do?

zap transactions? rescan? How do I actually do that though?  I will go over your previous answers.  And really appreciate everything you have already done.

Read the answers to https://bitcoin.stackexchange.com/questions/9046/why-is-my-transaction-not-getting-confirmed-and-what-can-i-do-about-it as I linked above, particularly https://bitcoin.stackexchange.com/a/22365/5757 which explains exactly how to do this.

How do I Run bitcoind and with -zapwallettxes.?

From the command line, e.g. ./bitcoind -zapwallettxes.  This is my last reply.

method not found (-32601)

Thank you though for what you could do.  I'll keep reading.

In any case, receiver (Coinbase) can't do much to make your transaction confirm faster. Except CPFP, but you can do the same with your change output, if you have it. But, as mentioned above, if tx fee really is 0, it will not be relayed by the network, as default relay fee is 1 satoshi per vbyte. Also, in 7 days it should have been confirmed, as mempool clears out regularly at the moment. I bet you will not see that transaction by txid in any public block explorer either. So, you should just send them again from the wallet you initially send them out.

how do i resend with the same inputs?  I am using bitcoin qt 4.8.3. It has been 7 days now.  Not confirmed. I mentioned cpfp and asked them to bill my account accordingly, I don't think they even understand what I am talking about.  Its all pre programmed email responses.  I still would like the transaction to go through and my coinbase account credited.  I am worried coinbase is going to change my coinbase btc wallet address.  This is my second btc transaction with them and my second coinbase btc wallet address.  I think thats how messed up they are.  Any suggestions?

Why do you need exactly the same inputs? Because of potential double spend risks? There is coin control button in Send tab or bitcoin-qt, where you can select individual UTXO's.

I have a bitcoin qt node/wallet 4.8.3 I'd like it to show that I have that unconfirmed transaction back.  At this point my wallet is debited, I'd like to make it whole.  What should I do?

Have no idea what is 4.8.3, latest release of bitcoin-qt is 0.18.1. https://bitcoincore.org/

Updating now. Syncing to the network. See what happens. Not to confident I will get the results I'm looking for. With 0.18.1 can I cancel the unconfirmed transaction? Or will it just sync correctly? Don't know, will find out later in the day.

https://bitcoin.stackexchange.com/questions/54284/how-do-i-get-rid-of-an-unconfirmed-transaction-on-bitcoin-core-0-14-1


text:
Longest unconfirmed transaction?
I recently tried to make a transaction with coinbase. In a hurry I put no fee though. It's still unconfirmed and blockchain.info doesn't recognize my hash. But my btc qt wallet is debited. My question is what is the longest unconfirmed transaction you've heard of? Mine is going on 16 days. I'm curious because I would still like the transaction to still go through.

A transaction could go unconfirmed indefinitely.
The order in which transactions are confirmed is decided by miners, and generally they will be incentivized to include only the highest fee-rate transactions, to maximize their revenue.
Even a low fee-rate transaction may eventually confirm, once the mempool clears out. But there is no guarantee of this, if the mempool is full for an extended period of time, many nodes may drop the lowest fee-rate transactions from their mempool, to free up memory resources (otherwise, you could DoS attack the network by publishing infinite low-feerate transactions).
Ultimately, once you publish a transaction to the network, you cannot be certain if or when it will be confirmed, until it is. By paying a high fee-rate, you can help increase the chances you will see a quick confirmation. On the other hand, a low fee-rate transaction may never be confirmed, as eventually all nodes may 'forget' about it.
If you have been waiting a long time for a transaction to be confirmed, you could publish a new transaction that spends the same output, but with a higher fee. You may have to force your wallet to forget the old transaction so that it will craft a new one (eg bitcoin-cli abandontransaction "txid" when using bitcoin-core), but not all wallets will include this functionality.

So do I have the record? 17days now. I've emailed coinbase about paying a miner to hash it and charge me the appropriate fee. I still want the tx to go through. I don't think they even understand what I'm talking about. Anyone in the community who wants to make some money and do this, let me know?

@dave I don't think that coinbase can do that.

They might not offer it, but shouldn't they be able to. I'm saying shouldn't they be able to offer such a service. They claim to be this great crypto company. But they are revealing themselves to be the next WeWork. At least in my eyes. I'm just looking for help on my transaction. I didn't mean to turn this into a condemnation on coinbase. It is what it is. I've gotten better results on the dark web. Use coinbase at your own peril. I have screen shots of it all too. I'm not just ranting. I have documentation of their failure. Anyone have a good crypto lawyer?

@dave your transaction certainly holds no ‘longest-unconfirmed record’. if you’d like to send a payment to someone, it is your responsibility to ensure the transaction will confirm. No business is liable to ‘help confirm’ a transaction that will otherwise not confirm of its own accord.

I understand, my beef is not with the blockchain. It's with coinbases lack of customer service and support. Again, I truly don't think they are aware of the engineering behind btc. I've asked them to approach a mining pool, like viabtc or antpool to find my block and hash it. I told them to push the fee onto my coinbase account. They haven't gotten back to me in 5 days. It seems everyone is upset with my discontent with coinbase. What would you suggest I do? Real talk. Please advise in simply and pragmatically. Bear in mind my btc qt is syncing now from upgrading and is taking forever. Thanks

@dave I don’t mean to be rude, but what you’ve asked them to do is over complicated and far beyond what I would expect any reasonable business to do (you seem to also have a misconception of how mining works, but that is besides the point). The solution is simple: you need to craft and broadcast a new transaction. You can do this with bitcoin-core, or any other wallet that you can import your private keys into. If you’d like further help, it would be best to join this sites chat room (the mempool), comments like this are not a place for extended discussion.

I don't have a score of 20 yet to join the chat. Still at 10.

I've downloaded electrum now. P.S.: your not rude. I'm American and poor. It's like water off a ducks back.

@dave I think you should now be able to join the chat: https://chat.stackexchange.com/rooms/8089/mempool

I am still curious about the longest transaction because I would still like my transaction to go through.


text:
What would be the effect on the number of leading zeros hash generation if bitcoin increase its nonce size from 32 to 60 or 100 bits?
If Bitcoin increases its nonce size from 32 bits to double or triple the size, how will it affect the speed of getting the right hash with the required number of zeros?

Increasing the nonce size would not increase or decrease the expected block time.
The block time is maintained via the difficulty adjustment algorithm, which adjusts the network difficulty according to the apparent time it took for the last 2016 blocks to be found. How quickly blocks are found can thus be used to estimate how many hashes/second the network's miners are collectively performing. The limitation for how many hashes/second a miner can perform is hardware-based (ie. "I own an ASIC miner that can do some amount of hashes per second"), not nonce-based (ie. "I'm running out of possible input values").
This is because if the nonce-space is exhausted, then the timestamp can be incremented, and the nonce-space can be searched through again. A miner can alter the transaction content of the block, or even just the coinbase transaction, and then the nonce-space can be searched through again. So while the nonce-space for a specific block template may be exhausted more quickly with a smaller nonce size, we can effectively 'increase the nonce' infinitely, by adjusting other input variables and then incrementing through the nonce-space again.
Since mining utilizes the SHA256 hash function, the number of input bytes that you can arbitrarily alter (ie increment as a nonce) will not affect your ability to generate a desirable output (ie, a valid block hash). So as long as you can alter some parts of the input arbitrarily, so as to not run out of possible input values, it seems to me that the bottleneck to finding a valid hash will be hardware-based, not algorithmic-based.


text:
Can I transfer money from my Deferred Compensation Plan to buy Bitcoin?
I have money in a Deferred Comp plan and want to use it to buy Bitcoin.

You can use money to buy Bitcoin by using a Bitcoin exchange. I don't know what a DCP is, but what you can use that money for is not a question relating to Bitcoin, so I'm voting to close this.

That sounds like something only the manager/organizer of your DCP would be able to answer or arrange, so as @HighlyIrregular said this is off-topic here I'm afraid

You can, but maybe you shouldn't.
Don't buy Bitcoin using money that you can't afford to lose.

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


text:
Volume in the Charts is different than what gets returned from the API's
when I pull volume data (BaseVolume?) from the Bittrex (for example) API every minute, draw a chart from that data and then compare that with the one minute timeframed volume chart (the study chart) on Bittrex it looks totally different.
I used BaseVolume, but i also tried to draw graphs with any other field that gets returned and I can't seem to replace these charts at all with any value. Does anyone have any idea?
Thanks

It's not clear which API call that you are using so I'll give my two ideas on what the problem might be:

If you are using the "getmarketsummary" API call and calling that
every minute then you will get wrong data because this is based on
24-hours. In my opinion, this is a useless feature.
If you are getting the market trades and then calculating the OHLCV
value in 1-minute periods, and those values don't match up with the
Bittrex candle charts then you are probably seeing the 2 to 4 minute
delay that Bittrex has. I use a service (ClueDex) that removes
that delay and I can literally get 1-minute OHLCV candle data as
soon as the minute closes.

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


text:
Why does Blockchain.com service gets stopped after a time?
I've installed Blockchain.com local machine on our server and ran its service using the command below:
blockchain-wallet-service start --port 3000

It works well, but after an unknown time, it seems that service gets stopped and I have to execute the command above again to be able to call APIs. Do you know what is the reason? Is there any limit on being that service active? And finally, do you have any special solution to make this service active all the time?

Have you checked the system logs?

What kind of log do you mean? And where is located? My server OS is CentOS 7

/var/log/messages and maybe /var/log/secure

Nothing special


text:
Is Bitcoin Core required for wallet projects?
My team wants to create a cryptocurrency service provider platform to Sell/Buy BTC and something else in form of web/mobile app. It's about one month that I have been studying different articles about its requirements. The crucial things we need in this project are:
1- Creating wallet for customers
2- Let customers to send/receive BTC from/to their wallets
I found both API providers, and something else like Bitcoin Core, Bitcoind, etc.
We prefer to build our own platform and avoid depending on 3rd party vendors.  May you tell me do we need Bitcoin Core to do our project needs? If your answer is yes, can we install it on a server and access to it remotely via API?

Bitcoin Core is not required to do anything, but it is a useful software that you can use instead of trying to reimplement everything it does. Or you could use some other software that does the same thing. However Bitcoin Core is by far the most used and reviewed software compared to other node and wallet software.

You can use Bitcoin Core to create wallets and let customers send and receive to/from those wallets. However Bitcoin Core is not well optimized for having a large number of wallets (note that a wallet is not the same thing as an address), so it may not be the best for your use case. Of course, if you instead use the traditional model of one exchange wallet and just giving out depositing addresses to users, it's fine (users should not expect to "send from" "their" address).

Thank you very much. Your answer was really useful because we might went to a wrong way. May you suggest us or give us more information about other suitable models? Our needs are clear, and I hope you can suggest us what requirements do we need?


text:
Bitcoin Core JSONRPC only accept requests with 0.0.0.0 in configs
I've lunched a Bitcoin Core server, and trying to connect to it via JSON-RPC.
This is my configuration settings:
server=1
rpcuser=admin
rpcpassword=password
rpcport=1234
rpcallowip=94.183.32.151

But all cURL connections to this server via the IP 94.183.32.151 has the same error result as:
cURL error 7: Failed to connect to 94.183.32.151 port 1234: Connection refused
I tried adding this option too, but it did not solve the problem:
rpcbind:94.183.32.151
Only when I put 0.0.0.0 as a bined RPC IP, Bitcoin core returns true response. I've checked many pages but did not find any other appropriate way to allow some certain IPs to Bitcoind. May you help me please?
Note: IP, Port number, username and password are changed from real values.

You should never, ever be exposing your RPC port. You wouldn't pass your banking information in cleartext, why would you do the same with your bitcoin credentials? The option shouldn't be in Bitcoin Core at all honestly.

@Anonymous, we defined a secret port number for JSON RPC connections, and only we know what is it. What's the problem here?

It takes tens of seconds scan all 65535 ports on a host. The entire internet, every one of the 281474976710656 ports, is scanned constantly, even by public services like shodan.io. The idea that your port is "secret" is comical, especially in the context of it being a security measure.

Our platform is on the server 1 and the Bitcoin core has installed on the server 2. We receive requests from users on the server 1 and have to ask server 2 to do them. Do you have any other solution?

If your solution is to transmit key material in plaintext over the internet, maybe you should find a job that isn't engineering security sensitive services that handle other people's money. Assuming you don't take that advice, consider using a VPN to connect the two together.

If your server is behind a NAT or otherwise does not have 94.183.32.151 as the IP address for one of the network interfaces, then rpcbind=94.183.32.151 won't work. You can check what IP addresses your node actually has using ifconfig and then rpcbind=<ip> for one of those.
For example, because my node is behind my router's NAT, I have to do rpcbind=192.168.1.2 instead of binding to my external IP of 12.34.56.78.

We are not behind a NAT and the given IP is the true one.


text:
How to use Multisig feature on Bitcoin Core RPC in an online exchange?
I've craeted a small online exchange based on Bitcoin Core. The features in this application are:

User send request to get a new address, and the Bitcoin Core generate a new one with defined passphrase.
User can receive BTC on his own address.
User can send BTC from his own address, and for this purpose, I've used sendtoaddress after unlocking account with walletPassphrase.

In this scenario, there is one complicated passphrase which is able to unlock all accounts. But after reading about multisig feature, I thought about implementing a scenario in this regard on my application. But there are some questions in my mind:

I have used a fixed passphrase in my codes while sending transactions. Regarding to multisig concepts,  I need to use different private keys to sign data instead of using a passphrase to unlock that account. Am I right?
As the operation in an online exchange should be do automatically, I think I have to use all required private keys in the final step of my codes. In this case, I think I did not add any new security mechanism to my application as everything is located beside each other. Can I cound on security impact of multisig accounts in my application at all?

I hope you can help me so solve these issues in my mind.

Multisig does not make funds more secure just because you are using multisig. Multisig requires multiple keys to sign in order to release funds. The typical use case is with multiple parties holding the required keys. That way in order to spend multiple parties need to agree and sign. If all of the keys required to sign are held by a single party then it defeats the purpose of multisig and no additional security has been added.

Do you think as operations should be automatically done in online exchanges, is it possible to use multisig approach in such project?


text:
Why am I receiving an email from Blockchain about receiving a payment?
I do not own bitcoin and do not belong to Blockchain but received an email from Blockchain about receiving payment...
Incoming Payment
You just received 3.86655869 BTC from an external Bitcoin account.
Authorize 3 network confirmations to add incoming  3.86655869 BTC to your Bitcoin balance.
What does this mean?

It's either a mistake, or (more likely) a scam. Either way, there is no need to respond.

It’s just a scam.

Why am I receiving an email from Blockchain about receiving a payment?

You aren't. It just looks that way, superficially.

received an email from Blockchain

It is easy to fake the "from" address in an email.
If your email app lets you view the full raw email headers you can probably see that this email followed an unusual path to reach you. But you don't need to do this. Businesses like Blockchain don't send emails to people who are not already their customers.

Authorize 3 network confirmations to add incoming 3.86655869 BTC to your Bitcoin balance.
What does this mean?

It is nonsense. It looks like a phishing email where someone is attempting to trick you into some sort of scam. Either getting you to divulge account details which will allow them to steal money or getting you roped into some kind of advance-fee fraud where they persuade you to pay them a release-fee or some other invented nonsense that is plausible to the inexperienced.
I would delete that email and forget about it.


text:
Can I still claim the pre-fork BCC with a current balance of 0 from Bitcoin Core wallet?
I had BTC in my Bitcoin Core wallet before the BCC fork, but I didn't claim the BCC before transferring my BTC to another wallet after the fork.  Is it possible to claim the pre-fork BCC even though my Bitcoin Core wallet balance is currently 0?  If yes, how do I go about claiming the BCC from my Bitcoin Core wallet?

What you did after the fork on the bitcoin blockchain has no effect on the BCC chain at all. All that matters is what you had at the time of the fork. You can follow the regular BCC claiming instructions.


text:
Do you start from the LAST NONCE to find the correct HASH to solve Hash Puzzle in Bitcoin Mining?
I'm reading the example of the simple proof of work algorithm from here: https://www.oreilly.com/library/view/mastering-bitcoin/9781491902639/ch08.html#pow_example_outputs
In that example, the nonce always starts from ZERO and incrementally going to the max_nonce:
for nonce in xrange(max_nonce):
    hash_result = hashlib.sha256(str(header)+str(nonce)).hexdigest()

    # check if this is a valid result, below the target
    if long(hash_result, 16) < target:
        print "Success with nonce %d" % nonce
        print "Hash is %s" % hash_result
        return (hash_result,nonce)

In the real world of bitcoin mining, do you always start from the LAST NONCE and incrementally go up to find the correct HASH?
Because I don't see it makes sense if you start from ZERO again to solve the next math puzzle

The for-loop you describe is for a given block only.
So yes, when mining the next block at the next block-height, the nonce can be reset to zero, because the the header hash pre-image is now a new block template (new transactions, new header, potentially new difficulty). A zero nonce will not hash to the same header hash as the previous block with the same nonce, since the rest of the pre-image has changed.
Also, note that the nonce field no longer provides sufficient range for the difficulty on mainnet, meaning the for-loop can potentially complete without ever finding a valid header hash. In this case coinbase input script data can be iterated to "expand" the nonce-range.

In this case coinbase input script data can be iterated to "expand" the nonce-range.

So coinbase input script data is also similar vaclue to nonce?

@Grady everything is similar to the nonce. Every combination of transactions, mining payouts, nonce, timestamp, ... is an individual and independent attempt at solving the block. The nonce is simply the easiest thing to change to get a new try, but it is by no means the only one.


text:
Would it really be this easy to steal peoples bitcoins?
I was just looking for an Ethereum wallet app for Android, and something hit me.
Could someone create a wallet app for Android/iOS that simply pretends to create a wallet address but really just displays the address of the one who created the app, causing the victim to transfer his/her funds straight to the app creator instead of their (supposedly) newly created wallet?
This seems too easy...

Yes, of course this would work.
What do you expect? It's the digital equivalent of walking into a random building with a storefront that vaguely looks like a bank with lots of dollar signs, and then asking "hey i want a bank account, where do I send money?".
Don't install random wallet software. Do research.

Has this happened (yet)?? Seems like a scam just waiting to happen. I think a lot of people who just got into crypto currencies are uneducated and lazy. If they were looking for a bank they'd just go with the one that their parents or friends have always used, but with apps there are a gazillion and none of them have well known names like "Bank of America" or "Citigroup", so I guess a large portion of people just pick one that sounds (and looks) good and "try it"...

Yes, there are plenty of cases of scam wallets.

It sounds strange, but something like this happens a lot.
Scammers try everything. They write apps as you described. I have already seen one of them (not in any app store but offered for free on a website). You only need to know Java basics and could program a fake application and some people would fall for it.
They do also write "It's hardfork!! Give us your private key to save your bitcoins during the fork"-websites...


text:
Buying actual bitcoins vs derivative paper products?
I bought some bitcoins on Localbitcoins and Coinbase a few months ago, as a purely speculative "investment".
Now I noticed that there is a Bitcoin certificate with 1:1 leverage available at the online bank I have used to trade traditional stocks and stock funds for the past 10 years. The buy and sell fees are 2.5% for the certificate.
Now I'm curious if there is any reason to bother with the risk and hassle of using cryptocurrency exchanges or if I could just as well just buy the certificate if I want to "invest" more in Bitcoin? The online cryptocurrency exchanges have similar fees, and it seems like the risk is higher and the user experience is much worse, especially when selling and withdrawing to fiat currency.
Obviously I'm not interested in using bitcoins for payment, this is for pure speculation purposes.

That has nothing to do with Bitcoin. Who knows what your online banks iou mean or are worth. This is blatantly off topic here. Now that btc futures are traded in chicago a lot off people with no knowledge of btc are asking finance questions here. The only answer remotely related is that in united States the Bitcoin exchanges in most states need to pass regulatory committees.

So... I take this as "there is no reason to bother with the hassle and fees of buying and selling real Bitcoin in Bitcoin exchanges if speculating and not intending to use and/or hold on to the Bitcoins long term"?

How and who did you interpret that? Bitcoin true value is real. To prove it I say you can't own a Bitcoin unless someone chooses to give it to you. Can you steal one? Now what stops someone from forging paper work, or otherwise refusing to accept your paper work or records. With Bitcoin this can not happen, unless majority of users choose to work very hard.

From a financial institutions perspective a Bitcoin is nothing more than a commodity. How that institution deals with that is not really related to Bitcoin as a technology. Can you understand that maybe? Really I'm trying to help you get an answer but I think there are other se sites than this. Like specialising in a field.

So if your question is, "is btc secure?" Why not just say that or refer to existing answers to not ask duplicate. A Bitcoin expert wouldn't be an expert in bank leverage or margins or investment securities. Bitcoin while may be used as an investment, like virtually anything; is not about selling for dollars on exchanges. Sadly there are experts in that area in financial exchanges, ecomics se, finance se, and probably at your little bank too. You can split hairs but this isn't about nay saying Bitcoin taking sides. There is proof of work you can read about on crypto se too. Best of luck.

@marshalcraft I'll rephrase the question: A lot of people who want to speculate on the current Bitcoin frenzy are asking "Where do I buy Bitcoin?" and "How do I buy Bitcoin?". Why should they buy Bitcoin in the first place? Why not just buy a certificate at your ordinary bank where you usually buy stocks and funds? Seems a heck of a lot easier to me for people who are not interested in using Bitcoin but just want to speculate in it, rather than researching how/where to buy it and then going through the hassle of ID verification, bank transfers and whatnot.

Again, I'm not gonna participate in a perpetual flame war with you. Again I do not see how that is in anyway related to bitcoin. You do realize just because you use the word bitcoin doesn't automatically mean the phrase, sentence, paragraph, paper, etc is related. I don't see anyone posting an answer, and the end goal here is to get good answers. So I say try in a se site more related to the question. Sure someone could post an answer that exactly is what you are looking for. Or maybe suddenly useing bitcoin iou's written on paper. But none of that is related to bitcoin at the end of the day.

And in helping people in general get good, quality answeres in timely matter. Sticking to related subjects is a vital tool. So go ahead and argue. I've flagged this as off topic and hasn't been resolved yet. So if I'm wrong and somehow this is related then ok. But you and I both know, nothing of real value will have been added. Tell yourself what ever you want.

You only own a bitcoin, if you control the private key. What happens when the online bank (a much more lucrative target than regular joe for hackers) gets hacked, and the bitcoins are siphoned away via monero or other methods? What happens when the bank makes a poor gambit and fails?
Compare that to the risk of losing your own private key, getting mugged/robbed, or losing everything due to other reasons (serious brain incident leaving you vegetative). If you manage to keep your coins safe, and you leave clear instructions on how to access the bitcoins when you are absent, why would you not just go to an exchange?

I was expecting this type of answer. As I said, it's for speculation. As far as I'm concerned nothing different from speculating and trading stocks. Just as I wouldn't buy and sell physical gold, oil or wheat if that's what I'm speculating in, I am wondering if there is any benefit to buying and selling real bitcoins as opposed to a certificate. I own physical gold and silver, but I'm not expecting to sell it in a hurry. Isn't the risk of a bitcoin exchange being hacked bigger than a major traditional bank? Transferring to a offline wallet adds more hassle and fees.

BadCash then why are you asking here?


text:
What can I do if I suspect that my Mycelium word list backup has been compromised?
When creating a backup with the Mycelium app, it gives me a list of 12 words which are used as some form of seed which I am supposed to write down and store in a safe place. Anyone with access to this word list can access any current and future funds in the wallet.
Well, what if my safe place gets compromised and the list of words stolen - can I somehow cancel the backup and generate a new one? Or would I need to set up a new wallet and transfer my funds there and just abandon the old one?

There is no way to cancel the backup. Also you cannot be sure if it is comprised until the person actually spends the funds.

Transfer the funds to a new wallet
Diversify risk: Don't but all funds in one wallet !

the word know is missing. further, he/she could have other means to verify that his safe place has been compromised.

Thanks for your answer. Yeah, of course I can't be 100% sure if it's compromised until someone actually takes the funds. Likewise, I can't be sure if my credit card is really stolen or just misplaced, but I'd still call my bank and cancel it. I mean in the case I'm suspecting that the backup has been stolen, I'd just rather be on the safe side than think "they'll never figure out what those words are!" lol. It seems that the Mycelium dictionary is rather limited, so someone into Bitcoins could be able to recognize some of the "random" words and try them out if they find my backup note.


text:
Electrum: How to generate hardened public addresses with HD BIP32 wallet
Please comment on the accuracy of this explanation.
Scenario: The master public key is compromised and so all non-hardened public addresses can be generated and monitored by a third party. This negates the privacy gained from avoiding address reuse. (The third party cannot spend any bitcoins from these addresses however).
Hardened public keys cannot be generated from the master public key, and a priori cannot be attributed to the owner of the non-hardened addresses above.
Is it possible to generate such hardened keys in Electrum, and if so, how?

Electrum uses a few different derivation paths for various script types. For example for legacy p2pkh addresses (addresses beginning with 1) it uses m/n/i where m is the extended private key (xprv) derived from the seed, n is 0 for external and 1 for change addresses and i is the address index with addresses being generated sequentially starting from 0. Electrum also lets you create a wallet using any xprv and then it'll assume that xprv is m in the derivation path and generate addresses relative to that. So all you have to do is restore your wallet from a hardened xprv such m/1' and electrum will then generate addresses relative to that. These addresses will not be visible to the person who has the extended public key for m.
To generate a wallet using m/1' you can use this script like so:
electrum getmasterprivate| python3 xprv.py -m - -d "m/1'" -p|electrum -w wallet_name restore -

I didn't actually understand what you want.

Hardened public keys cannot be generated from the master public key, and a priori cannot be attributed to the owner of the non-hardened addresses above.

There's no "hardened xpub (extended public key)" at all.
There are only "hardened childs" or "normal (non-hardened) childs", of one parent xprv (extended private key).
The normal childs are derived from the parent public key, while the hardened childs are derived from the parent private key, so that any hardened childs can only be derived with the knowledge of the parent xprv (which contains  the parent private key and the parent chain code).
Currently, Bitcoin Core uses the hardened childs directly as keys of receiving/change addresses (receiving addresses would be m/0'/0'/0', m/0'/0'/1', m/0'/0'/2', ...etc).
As far as I know, Electrum currently doesn't support such "hardened address" option. However, this could be also achieved with other tools, like Ian Coleman's BIP39 tool.

Although @Abudussamad had already provided a straightforward method, I think his method is not standard-compliant, though.
If you just followed his guide, your receiving addresses would be derived through "weird" derivation paths, like m/1'/0/0, m/1'/0/1 ,m/1'/0/2, m/1'/0/3, ...etc, while your change addresses would be derived through m/1'/1/0, m/1'/1/1, m/1'/1/2, m/1'/1/3, ...etc.
See, your addresses will be actually derived at the depth of 3, while regular Electrum wallets derive their addresses at the depth of 2:
The receiving addresses would be m/0/0, m/0/1, m/0/2, ...etc, while the change addresses would be m/1/0, m/1/0, m/1/0, ...etc.

In my opinion, it's better to achieve this goal with the BIP39/44/49/84 standard scheme.
BIP44/49/84 provide separation among different "accounts". If the xpub of "account 0" has already been compromised, you can simply switch to "account 1", which does not have any observable linkage to the compromised "account 0", as long as the parent "coin" xprv (which derives all the "accounts" from 0 to 2^31) is still kept secret.
This is easy to do with a BIP39 mnemonic, although Electrum always shows warnings about it. After checking "Use BIP39 seed" in the option dialog, Electrum will show you three different address type options.
For example, if you chose the legacy address type, Electrum would automatically fill the derivation path with m/44'/0'/0'. The last 0' was the account index number, of the 1st account. You could change this number to other value, like m/44'/0'/1' or m/44'/0'/2', which corresponded to the 2nd or 3rd account respectively.
If you then chose to use the 3rd account (m/44'/0'/2'), your receiving addresses would be m/44'/0'/2'/0/0, m/44'/0'/2'/0/1, m/44'/0'/2'/0/2, m/44'/0'/2'/0/3, ...etc, while your change addresses would be m/44'/0'/2'/1/0, m/44'/0'/2'/1/1, m/44'/0'/2'/1/2, m/44'/0'/2'/1/3, ...etc.

Is it possible to generate such hardened keys in Electrum, and if so, how?

It is not possible to generate hardened keys in Electrum because Electrum does not allow you to enter your own BIP 32 derivation paths. The hardening is based upon the derivation paths.


text:
Are there any places where should not use compressed public keys?
It is always worthwhile to use compressed keys to save size. Or somewhere in the Bitcoin code, exactly uncompressed keys are needed?

There is no one advantage to use uncompressed key vs compressed.
So, there is no one place in code where uncompressed key is allowed and compressed key is disallowed

https://github.com/bitcoin/bips/blob/master/bip-0143.mediawiki#restrictions-on-public-key-type


text:
How do I transfer bitpay wallet from one machine to another (PC or oth. type of device)
I have a new PC that I want to host my bitpay wallet on, so I need to migrate it from the current machine. I did a superficial search on the current machine for *wallet.dat* file in my C: drive w/ dir /s *wallet.dat* but it seems like bitpay uses a different storage model.
Question: How do I migrate bitpay wallet from any type of device to another device of any type?

Found it. There are 3 ways to do that in bitpay.

Export by scanning the QR code that can be found in: Settings > "Wallet name" >
More options > Export wallet
Export to file w/ password. Same path as before.
The backup option w/ the backup phrase, in: Settings > Backup


text:
Withrdawing bitcoin from web-based exchange wallet to local wallet. My wallet passphrase is requested- is this necessary?
I understand (maybe incorrectly) this is the seed passphrase/ the 12 words generated when wallet is created. Is this normal to provide this information to the web-based wallet when sending it, to receive it in a local wallet?
When withdrawing the funds from the "cloud" wallet to my local wallet.. wouldn't providing my seed/passphrase be a security flaw as a wallet can be recovered from it? Or am I interpreting this as the wrong passphrase...? I am using Electrum as my local wallet.

NEVER share your seed pass phrase/mnemonic. Anyone that has it can steal your bitcoins, and there is NO reason a web-wallet would need it in order to transfer your funds.
If the web-wallet is requesting a password in order to withdraw funds, it is most likely the password to log in to your web wallet account, or a secondary password you set up to spend funds from your web wallet account.

Thank you,  this has saved me...  This makes me wonder - What is stopping a brute force dictionary attack?!

The library of words used to generate mnemonics is very large, so the entropy of a 12 word phrase generated using that list is sufficiently large enough to make brute force attacks not worth the time. There are some explanations of this with numbers available online if you do a quick google search


text:
Sybil attack countermeasure
In Bitcoin Wiki Weaknesses: Sybil attack they mention that:
"Bitcoin makes these attacks more difficult by only making an outbound connection to one IP address per /16 (x.y.0.0)".
Why would this make a Sybil attack more difficult? Is there a reason for choosing a /16 subnet or is it randomly chosen by the developers with no background?
Wouldn't it be more secure to choose a smaller subnet?

When you are buying servers you can order multiple IP per one server, typically in the same /8 or /16 subnet. So 1 server can serve as 100 or even 1000 Bitcoin nodes.
Ordering lots of IPs in lots of different /16 subnets is rarely possible for the same server.
Hence this change makes it harder/more expensive to launch 1000's of rogue Bitcoin nodes - you will have to distribute them across large number of servers in different datacenters.


text:
How does vin[] have to look like with multiple inputs in a raw transaction?
I've successfully created, signed an broadcasted a raw transaction. But this transaction had just one input. Now I would like to create a raw transaction where I take the funds from multiple transactions.
Here are the UTXOs of the from address:
{
    "address": "msJaKN7KCGARZrKWyy169GzztFLx7aTRBf",
    "amount": 0.001,
    "confirmations": 19,
    "label": "",
    "safe": true,
    "scriptPubKey": "76a914814a2c0bb0d155667341be55633e7351a7d5c57888ac",
    "solvable": false,
    "spendable": false,
    "txid": "0f5d09f4fa14f664e8fd55222e2e1e030afa0cf3b131d77e3bba7ef2a48a5580",
    "vout": 0
}
{
    "address": "msJaKN7KCGARZrKWyy169GzztFLx7aTRBf",
    "amount": 0.69735717,
    "confirmations": 16,
    "label": "",
    "safe": true,
    "scriptPubKey": "76a914814a2c0bb0d155667341be55633e7351a7d5c57888ac",
    "solvable": false,
    "spendable": false,
    "txid": "05ab7541fb9549707a8c467bc401a80e68461a4e31c416daf9f78169210a33d4",
    "vout": 1
}
{
    "address": "msJaKN7KCGARZrKWyy169GzztFLx7aTRBf",
    "amount": 0.01783446,
    "confirmations": 1031,
    "label": "",
    "safe": true,
    "scriptPubKey": "76a914814a2c0bb0d155667341be55633e7351a7d5c57888ac",
    "solvable": false,
    "spendable": false,
    "txid": "ccd36c5467ad0d9d1fa4f4d081020c066f1fa7ab9b734d9b0cc90b491eeeabdc",
    "vout": 0
}
{
    "address": "msJaKN7KCGARZrKWyy169GzztFLx7aTRBf",
    "amount": 0.005,
    "confirmations": 409,
    "label": "",
    "safe": true,
    "scriptPubKey": "76a914814a2c0bb0d155667341be55633e7351a7d5c57888ac",
    "solvable": false,
    "spendable": false,
    "txid": "7a2c020179f721b5321b58d3fcbb2988dbe4db905e174e918bd936a4e8a10ff8",
    "vout": 1
}

My unsigned raw transactions looks like this:
010000000480558aa4f27eba3b7ed731b1f30cfa0a031e2e2e2255fde864f614faf4095d0f000000001976a914814a2c0bb0d155667341be55633e7351a7d5c57888acffffffffd4330a216981f7f9da16c4314e1a46680ea801c47b468c7a704995fb4175ab05010000001976a914814a2c0bb0d155667341be55633e7351a7d5c57888acffffffffdcabee1e490bc90c9b4d739baba71f6f060c0281d0f4a41f9d0dad67546cd3cc000000001976a914814a2c0bb0d155667341be55633e7351a7d5c57888acfffffffff80fa1e8a436d98b914e175e90dbe4db8829bbfcd3581b32b521f77901022c7a010000001976a914814a2c0bb0d155667341be55633e7351a7d5c57888acffffffff02801d2c04000000001976a91459fe1a9f9f0a5af33396c59990f064be1ca5127488acdb072000000000001976a914814a2c0bb0d155667341be55633e7351a7d5c57888ac00000000

{
    "error": null,
    "id": "1",
    "result": {
        "hash": "c705c781ba6e131ec419582908ef607b628276948bd90f0d136b29a3c9524ff7",
        "locktime": 0,
        "size": 342,
        "txid": "c705c781ba6e131ec419582908ef607b628276948bd90f0d136b29a3c9524ff7",
        "version": 1,
        "vin": [
            {
                "scriptSig": {
                    "asm": "OP_DUP OP_HASH160 814a2c0bb0d155667341be55633e7351a7d5c578 OP_EQUALVERIFY OP_CHECKSIG",
                    "hex": "76a914814a2c0bb0d155667341be55633e7351a7d5c57888ac"
                },
                "sequence": 4294967295,
                "txid": "0f5d09f4fa14f664e8fd55222e2e1e030afa0cf3b131d77e3bba7ef2a48a5580",
                "vout": 0
            },
            {
                "scriptSig": {
                    "asm": "OP_DUP OP_HASH160 814a2c0bb0d155667341be55633e7351a7d5c578 OP_EQUALVERIFY OP_CHECKSIG",
                    "hex": "76a914814a2c0bb0d155667341be55633e7351a7d5c57888ac"
                },
                "sequence": 4294967295,
                "txid": "05ab7541fb9549707a8c467bc401a80e68461a4e31c416daf9f78169210a33d4",
                "vout": 1
            },
            {
                "scriptSig": {
                    "asm": "OP_DUP OP_HASH160 814a2c0bb0d155667341be55633e7351a7d5c578 OP_EQUALVERIFY OP_CHECKSIG",
                    "hex": "76a914814a2c0bb0d155667341be55633e7351a7d5c57888ac"
                },
                "sequence": 4294967295,
                "txid": "ccd36c5467ad0d9d1fa4f4d081020c066f1fa7ab9b734d9b0cc90b491eeeabdc",
                "vout": 0
            },
            {
                "scriptSig": {
                    "asm": "OP_DUP OP_HASH160 814a2c0bb0d155667341be55633e7351a7d5c578 OP_EQUALVERIFY OP_CHECKSIG",
                    "hex": "76a914814a2c0bb0d155667341be55633e7351a7d5c57888ac"
                },
                "sequence": 4294967295,
                "txid": "7a2c020179f721b5321b58d3fcbb2988dbe4db905e174e918bd936a4e8a10ff8",
                "vout": 1
            }
        ],
        "vout": [
            {
                "n": 0,
                "scriptPubKey": {
                    "addresses": [
                        "moinqaiuWShfsemB9nGcAGFZNMa3ZwPMq6"
                    ],
                    "asm": "OP_DUP OP_HASH160 59fe1a9f9f0a5af33396c59990f064be1ca51274 OP_EQUALVERIFY OP_CHECKSIG",
                    "hex": "76a91459fe1a9f9f0a5af33396c59990f064be1ca5127488ac",
                    "reqSigs": 1,
                    "type": "pubkeyhash"
                },
                "value": 0.7
            },
            {
                "n": 1,
                "scriptPubKey": {
                    "addresses": [
                        "msJaKN7KCGARZrKWyy169GzztFLx7aTRBf"
                    ],
                    "asm": "OP_DUP OP_HASH160 814a2c0bb0d155667341be55633e7351a7d5c578 OP_EQUALVERIFY OP_CHECKSIG",
                    "hex": "76a914814a2c0bb0d155667341be55633e7351a7d5c57888ac",
                    "reqSigs": 1,
                    "type": "pubkeyhash"
                },
                "value": 0.02099163
            }
        ],
        "vsize": 342,
        "weight": 1368
    }
}

I don't really know how the vin has to look like. My solution is obviously wrong.
How do the vins in the unsigned transaction to look like?
How do the vins in the signed transaction have to look like?

Firstly, the raw unsigned transaction shouldn't actually have anything in the scriptSigs. They should be empty. You only add stuff to them during the signing process, then remove whatever was added.
For multiple inputs, each input actually signs its own input specific version of the transaction. For the input you are currently signing, you put the scriptPubKey of the output that input spends into the scriptSig as you did previously (and are doing now). However all of the other inputs need to have blank scriptSigs (i.e. they are 00). So what you currently have is incorrect.
The result is that input 0 has its own "version" of the unsigned transaction where its scriptSig has the output's scriptPubKey and inputs 1, 2, and 3 have blank scriptSigs. Then you have another version for input 1 that has its output's scriptPubKey in the scriptSig and blank scriptSigs for inputs 0, 1, and 2. And so on for each input.
The keys involved in each input just sign their input's "version" of the transaction.

Thank you very much for the explanation. Now I finally understood the signing procedure. I could create, sign and broadcast a raw transaction with multiple UTXOs.

You can refer to the documentation here: https://bitcoincore.org/en/doc/0.18.0/rpc/rawtransactions/createrawtransaction/
Inputs are a JSON array of JSON objects
[] = array
{} = object
[{}] = object in array
From the documentation:
createrawtransaction [{"txid":"hex","vout":n,"sequence":n},...]
The sequence is optional and ellipses ... is where you would put your second input object so
createrawtransaction [{"txid":"hex","vout":n},{"txid":"hex","vout":n}]
Each new input requires a new {}object in the array. Please note the above wouldn't work without an output which I left out the output portion as this example was just for multiple inputs.
Below is a full example with two inputs and one output (beware of your change!) in testnet
createrawtransaction [{"txid":"1e1a0111ac4a918066d16180e397dea5537f934af1b4924105d27df48719b2c9","vout":0},{"txid":"c3877645f62f91b6fd5016ce9124acdc16b0a52f3b311c143a9e40e59618611b","vout":0}] [{"2N3peQ73BXhG9GDNVdAvWYpGBZZmr2ZqFeV":0.01}]


text:
How to manage externally created addresses?
In my application the private keys are created and stored on a HSM. When a new private key is created on the HSM, it returns the corresponding public key. With this public key I create a bitcoin address. Since these externally generated addresses are not part of a wallet, I'm unable to get the UTXOs of this address. Now my big questions is: How can I get the UTXOs of this address without importing it into a wallet?

Bitcoin Core has a scantxoutset command. You give it output script descriptors (which specify scriptPubKeys) and it will scan the UTXO set and return the UTXOs that have scriptPubKeys that match the given descriptors.

Is there also an rpc endpoint for scantxoutset?

Yes. I found it: curl --data-binary '{"id":"1","jsonrpc":"1.0","method":"scantxoutset","params":["start", [{"desc":"addr(msJaKN7KCGARZrKWyy169GzztFLx7aTRBf)"}] ] }' -H 'content-type: text/plain;' http://user:password@127.0.0.1:8332


text:
Can two bitcoin transactions from a Segwit address (p2sh-p2wpkh) have a reused R value?
Good day.
I'd found these two transactions:
https://www.blockchain.com/es/btc/tx/2b08d658045724aba40b58690ad84ec2af1f01ab58df37387dadd2b27789f44c
and
https://www.blockchain.com/es/btc/tx/5b51729c75794a5c6ea3c016923bc587895a0b790c4aea50d8bce8d472e5aa03
They're related to the SegWit address 3AQ4kUjQaDjCjmDh2ojKEHjUKTSi52UUqD.
I don't understand much about SegWit addresses transactions but it looks like the first part of each transaction has the same R Value 145d3cbed9f338b82667f410340fcb9bf401c7e837e9f4539b915fb8bced (if this is the R value).
Is that address private key compromised?
I readed something about using the same R value can be used to get the private key of an address.
(Even with the same R value used in transactions from different addresses, but only if you already know the private key of one of those, with something like k = ( digest + r * privkey ) / s or so, I didn't found more about this case).

Segwit does not use a different signature algorithm nor does it change any of the properties of a ECDSA signature. Thus if you find transactions that involve the same public keys and the same R value, then yes, the private key for that public key is revealed.
However, what you are looking at is not the R value. In fact, you are not even looking at the signature. Rather you are looking at part of the redeemScript. 145d3cbed9f338b82667f410340fcb9bf401c7e837e9f4539b915fb8bced is part of the hash of the witnessScript, not part of a signature.
The address 3AQ4kUjQaDjCjmDh2ojKEHjUKTSi52UUqD is a P2SH-P2WSH address. This means that it maps to a Pay to Script Hash (P2SH) output script, which has a redeemScript for a Pay to Witness Script Hash (P2WSH) script. The P2WSH script contains the hash of the witnessScript, which, in this case, is a multisig script.