Bitcoin Forum
May 12, 2024, 11:58:53 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Bitcoin Input with all address type  (Read 260 times)
BitcoinivaX (OP)
Newbie
*
Offline Offline

Activity: 9
Merit: 7


View Profile
March 15, 2021, 11:59:16 AM
 #1

Can I create a transaction containing all Bitcoin address? P2PKH (1) P2SH (3) Bech32 (bc1)
If possible, why would the wallets create a separate wallet file for each address type or you can have one recovery file but all addresses are separate.

The other question is, can I send money from several inputs one of those inputs is an address containing 0 Bitcoin or invalid one?
1715558333
Hero Member
*
Offline Offline

Posts: 1715558333

View Profile Personal Message (Offline)

Ignore
1715558333
Reply with quote  #2

1715558333
Report to moderator
"Your bitcoin is secured in a way that is physically impossible for others to access, no matter for what reason, no matter how good the excuse, no matter a majority of miners, no matter what." -- Greg Maxwell
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715558333
Hero Member
*
Offline Offline

Posts: 1715558333

View Profile Personal Message (Offline)

Ignore
1715558333
Reply with quote  #2

1715558333
Report to moderator
1715558333
Hero Member
*
Offline Offline

Posts: 1715558333

View Profile Personal Message (Offline)

Ignore
1715558333
Reply with quote  #2

1715558333
Report to moderator
1715558333
Hero Member
*
Offline Offline

Posts: 1715558333

View Profile Personal Message (Offline)

Ignore
1715558333
Reply with quote  #2

1715558333
Report to moderator
ranochigo
Legendary
*
Offline Offline

Activity: 2968
Merit: 4186



View Profile
March 15, 2021, 12:16:39 PM
 #2

Can I create a transaction containing all Bitcoin address? P2PKH (1) P2SH (3) Bech32 (bc1)
Spending from, yes. Sending to, yes.
If possible, why would the wallets create a separate wallet file for each address type or you can have one recovery file but all addresses are separate.
Not all. You can import addresses of different types on Electrum and Bitcoin Core as well. You can absolutely generate nested Segwit address from the same seeds but Electrum's checksum prevents this, probably to reduce the probability of newbies being confused when restoring their wallets.
The other question is, can I send money from several inputs one of those inputs is an address containing 0 Bitcoin or invalid one?
No, why would you do that? You have to reference a UTXO that is valid, OP_return inputs are not stored within the UTXO.

.
.HUGE.
▄██████████▄▄
▄█████████████████▄
▄█████████████████████▄
▄███████████████████████▄
▄█████████████████████████▄
███████▌██▌▐██▐██▐████▄███
████▐██▐████▌██▌██▌██▌██
█████▀███▀███▀▐██▐██▐█████

▀█████████████████████████▀

▀███████████████████████▀

▀█████████████████████▀

▀█████████████████▀

▀██████████▀▀
█▀▀▀▀











█▄▄▄▄
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
.
CASINSPORTSBOOK
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀▀█











▄▄▄▄█
o_e_l_e_o
In memoriam
Legendary
*
Offline Offline

Activity: 2268
Merit: 18512


View Profile
March 15, 2021, 12:17:47 PM
 #3

Can I create a transaction containing all Bitcoin address? P2PKH (1) P2SH (3) Bech32 (bc1)
Sure. Just import the private keys of all the individual addresses in to the same wallet together and create your transaction as normal.

The other question is, can I send money from several inputs one of those inputs is an address containing 0 Bitcoin or invalid one?
No. You cannot include an address with no coins in it as the input to a transaction. When you are selecting bitcoin to use in a transaction, you are selecting inputs, not addresses. The inputs just happen to be stored at various addresses. If there is no input to select, then you obviously cannot include it in a transaction.
BrewMaster
Legendary
*
Offline Offline

Activity: 2114
Merit: 1292


There is trouble abrewing


View Profile
March 15, 2021, 03:37:51 PM
 #4

Electrum's checksum prevents this, probably to reduce the probability of newbies being confused when restoring their wallets.

that's a shame though because this could have been a very good feature for wallets, maybe more in a couple of years ago than now but still a good one.
people usually need both address types, the segwit one to decrease their fees and the legacy one to receive payments whenever the payer cannot pay to a segwit address.
having the ability to generate different addresses from the same seed in the same wallet (without needing extra work and importing individual keys) could be very useful.

There is a FOMO brewing...
ranochigo
Legendary
*
Offline Offline

Activity: 2968
Merit: 4186



View Profile
March 15, 2021, 04:00:12 PM
Merited by BrewMaster (1)
 #5

that's a shame though because this could have been a very good feature for wallets, maybe more in a couple of years ago than now but still a good one.
people usually need both address types, the segwit one to decrease their fees and the legacy one to receive payments whenever the payer cannot pay to a segwit address.
having the ability to generate different addresses from the same seed in the same wallet (without needing extra work and importing individual keys) could be very useful.
Not really, nested segwit would be more than sufficient. The version bit (wrongly referred to as checksum by me, sorry) helps with normal users that aren't really that techsavvy, helping them to restore the wallet correctly years down the road. I don't think there's really any issue with separating the different address type as of now, would be confusing for some if suddenly different address types starts to spawn in the same wallet.

Anyways, it's not impossible to implement but they were fairly reluctant previously, or so when I was searching it up previously. There's an open github issue on this though: https://github.com/spesmilo/electrum/issues/6016.

.
.HUGE.
▄██████████▄▄
▄█████████████████▄
▄█████████████████████▄
▄███████████████████████▄
▄█████████████████████████▄
███████▌██▌▐██▐██▐████▄███
████▐██▐████▌██▌██▌██▌██
█████▀███▀███▀▐██▐██▐█████

▀█████████████████████████▀

▀███████████████████████▀

▀█████████████████████▀

▀█████████████████▀

▀██████████▀▀
█▀▀▀▀











█▄▄▄▄
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
.
CASINSPORTSBOOK
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀▀█











▄▄▄▄█
NotATether
Legendary
*
Offline Offline

Activity: 1596
Merit: 6739


bitcoincleanup.com / bitmixlist.org


View Profile WWW
March 16, 2021, 05:42:59 AM
 #6

If possible, why would the wallets create a separate wallet file for each address type or you can have one recovery file but all addresses are separate.

This is because in their wallet files store either a seed phrase + a bunch of addresses/private keys or just a bunch of addresses/private keys and some parent key that derives all the other keys.

It's easier for them to just store a single field that indicates the type for all derived addresses than to store a field for each and every address, and this latter format introduces the question: "what type will I give newly derived addresses?" (This is especially true for Bitcoin Core which pre-generates several hundred private keys in one go but doesn't expose them to the user until they ask for another receiving address).

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
Pmalek
Legendary
*
Offline Offline

Activity: 2758
Merit: 7138



View Profile
March 23, 2021, 08:17:21 AM
 #7

However, unlike a bank account, one wallet can have multiple receiving addresses generated by its public key.
A public key is derived from a private key. That public key can then be used to create addresses of various formats. So the same public key can be used to generate a legacy, a nested segwit, a multisig, a native segwit address... I assume that's what you were trying to say or was it something else?

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
bob123
Legendary
*
Offline Offline

Activity: 1624
Merit: 2481



View Profile WWW
March 23, 2021, 09:07:52 AM
 #8

A Bitcoin address is like a traditional bank account number.

I don't like that analogy.
IMO it is pretty far away from the reality and not really comparable.



However, unlike a bank account, one wallet can have multiple receiving addresses generated by its public key.

A "wallet" is just a piece of software or a combination of hardware and software which manages the keys for you.
A wallet does not have that one public key. They can generate multiple public keys derived from multiple private keys. It is comparable to a keychain.



The creation of new receiving addresses is availed of for privacy reasons, however, the coins are still sent to the same wallet

The coins are not "sent to the same wallet".
They are rather "assigned to the public key on the blockchain" (which technically also isn't completely correct, but it is "closer" to the technical truth).
Since your wallet then holds all the corresponding private keys, these coins can be spend by you.

o_e_l_e_o
In memoriam
Legendary
*
Offline Offline

Activity: 2268
Merit: 18512


View Profile
March 23, 2021, 09:32:10 AM
Merited by bitmover (2)
 #9

A Bitcoin address is like a traditional bank account number.
Yeah, I don't like that analogy either because it encourages address reuse, which is bad for your privacy. You can have a single bank account for years or even your entire life, and give out the account details to hundreds or thousands of different people to accept payments from, and suffer next to no consequences. However, if you use the same bitcoin address to receive a thousand different payments from a thousand different people, you let every single one of those people examine your entire financial history, your total income, who else you have transacted with, where you have moved your money to, and so on.

A better analogy is to think of a bitcoin address as an invoice or payment request you would generate for a single other person. You give them the invoice, they pay it, and then you never use the same invoice again. The next time you want to accept a payment, you generate a new invoice.
ABCbits
Legendary
*
Offline Offline

Activity: 2870
Merit: 7496


Crypto Swap Exchange


View Profile
March 23, 2021, 11:35:15 AM
Merited by o_e_l_e_o (2)
 #10

@Pmalek @bob123 @o_e_l_e_o you guys should share your opinion with Bitwala, the original author.

A Bitcoin address is like a traditional bank account number. However, unlike a bank account, one wallet can have multiple receiving addresses generated by its public key.

You can provide those new addresses to whoever wishes to send you bitcoin in order to conceal your original public key. The creation of new receiving addresses is availed of for privacy reasons, however, the coins are still sent to the same wallet. Thus, only your combination of keys can access and move the newly received bitcoin.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
Saint-loup
Legendary
*
Offline Offline

Activity: 2604
Merit: 2357



View Profile
March 23, 2021, 04:40:39 PM
 #11

Electrum's checksum prevents this, probably to reduce the probability of newbies being confused when restoring their wallets.

that's a shame though because this could have been a very good feature for wallets, maybe more in a couple of years ago than now but still a good one.
people usually need both address types, the segwit one to decrease their fees and the legacy one to receive payments whenever the payer cannot pay to a segwit address.
having the ability to generate different addresses from the same seed in the same wallet (without needing extra work and importing individual keys) could be very useful.
You can already do it with Bitcoin Core, from the same seed you can generate segwit bech32 addresses, nested segwit addresses and legacy addresses in the same wallet.
You just need to use getnewaddress in the Bitcoin Core console with the address type desired, each time you want a new address.  Smiley
https://bitcoincore.org/en/doc/0.21.0/rpc/wallet/getnewaddress/

██
██
██
██
██
██
██
██
██
██
██
██
██
... LIVECASINO.io    Play Live Games with up to 20% cashback!...██
██
██
██
██
██
██
██
██
██
██
██
██
NotATether
Legendary
*
Offline Offline

Activity: 1596
Merit: 6739


bitcoincleanup.com / bitmixlist.org


View Profile WWW
March 23, 2021, 04:58:01 PM
 #12

@Pmalek @bob123 @o_e_l_e_o you guys should share your opinion with Bitwala, the original author.

~

I really don't like some of the material on that page:

Quote
Brain wallets

If you’re feeling risky, then you might consider using a brain wallet. Disclaimer: we wouldn’t if we were you.

No, you don't ever do this even if you do feel risky because there are programs out there like brainflayer being ran by hungry thieves across all the possible inputs and will take any opportunity to wipe your funds. It's not enough to downplay it by saying "we wouldn't if we were you". They don't even mention how insecure they are.

Quote
Anyways, it’s harder for a hacker to crack two keys than one and that’s why multi-signature solutions are better to ensure enhanced security. It’s also harder to lose two keys than just one. That’s if you store them separately (of course, both in highly secure locations/multiple highly secure locations). That way, if you lose one, you still have access to your coins.

(I assume this is 1-2 Multisig) Hackers usually don't crack the keys, they steal them! So having two different keys is completely useless if somebody just needs one to spend.

Quote
Two out of three keys are required for Bitcoin transactions to be authorised and for a wallet recovery to be performed.

This is not a hard requirement, any M-N scheme can be used as long as M <= N.

Quote
One way to perform a wallet recovery is to go to a GitHub.io hosted page (specified by your wallet client) and enter your backup key/seed phrase.
...

 Shocked I'm not even going to begin talking about this. And it's right at the beginning.

(Hint: would you enter your credit card number on some random Github.io site, especially considering ANYBODY can create one for free?)



It's too bad they don't have a contact page anywhere because there's some really nasty technical errors in this article.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
BrewMaster
Legendary
*
Offline Offline

Activity: 2114
Merit: 1292


There is trouble abrewing


View Profile
March 23, 2021, 05:29:51 PM
 #13

You can already do it with Bitcoin Core, from the same seed you can generate segwit bech32 addresses, nested segwit addresses and legacy addresses in the same wallet.
You just need to use getnewaddress in the Bitcoin Core console with the address type desired, each time you want a new address.  Smiley
https://bitcoincore.org/en/doc/0.21.0/rpc/wallet/getnewaddress/

usually all wallets have a workaround to do something like this, mostly through creating a new wallet and importing the key with a different address type and sometimes using command line like this.
the problem is that there is no easy way (specially if you are using deterministic wallet) to derive multiple address types from the same seed.

There is a FOMO brewing...
Saint-loup
Legendary
*
Offline Offline

Activity: 2604
Merit: 2357



View Profile
March 23, 2021, 07:02:09 PM
Last edit: March 23, 2021, 07:18:17 PM by Saint-loup
 #14

You can already do it with Bitcoin Core, from the same seed you can generate segwit bech32 addresses, nested segwit addresses and legacy addresses in the same wallet.
You just need to use getnewaddress in the Bitcoin Core console with the address type desired, each time you want a new address.  Smiley
https://bitcoincore.org/en/doc/0.21.0/rpc/wallet/getnewaddress/

usually all wallets have a workaround to do something like this, mostly through creating a new wallet and importing the key with a different address type and sometimes using command line like this.
the problem is that there is no easy way (specially if you are using deterministic wallet) to derive multiple address types from the same seed.
Yes you can import adresses in different formats on Electrum for example. But your wallet won't be a Hierarchical Deterministic wallet as you say. But with Bitcoin Core your wallet will remain deterministic since all adresses generated like that are derived from the same HD seed. That's why it can be a good solution for the use case you mentioned above in my opinion.

██
██
██
██
██
██
██
██
██
██
██
██
██
... LIVECASINO.io    Play Live Games with up to 20% cashback!...██
██
██
██
██
██
██
██
██
██
██
██
██
o_e_l_e_o
In memoriam
Legendary
*
Offline Offline

Activity: 2268
Merit: 18512


View Profile
March 23, 2021, 10:06:25 PM
 #15

Yes you can import adresses in different formats on Electrum for example. But your wallet won't be a Hierarchical Deterministic wallet as you say.
The simplest way of using the same seed for all the addresses is probably going to be to use a BIP39 seed with Electrum, import it three times to create three separate wallets - a P2PKH, a P2SH, and a P2WPKH wallet - and then export the individual private keys for each address you want and import them all in to the same wallet. You could also do something similar with a tool like Ian Coleman. By doing this, you keep each address type under the standard derivation path, so future recovery is as straightforward as possible.

The other option is to create a single wallet in Electrum, export the private keys you are interested in, and then import those private keys in to another Electrum wallet, using the same private key to generate one of each of the three above address types. The problem with this is you have to remember that you are using a private key from a "legacy" derivation path m/44'/0'/0'/0/0 to derive a P2WPKH address, for example.
Saint-loup
Legendary
*
Offline Offline

Activity: 2604
Merit: 2357



View Profile
March 24, 2021, 01:32:46 AM
Last edit: March 24, 2021, 02:01:20 AM by Saint-loup
 #16

Yes you can import adresses in different formats on Electrum for example. But your wallet won't be a Hierarchical Deterministic wallet as you say.
The simplest way of using the same seed for all the addresses is probably going to be to use a BIP39 seed with Electrum, import it three times to create three separate wallets - a P2PKH, a P2SH, and a P2WPKH wallet - and then export the individual private keys for each address you want and import them all in to the same wallet. You could also do something similar with a tool like Ian Coleman. By doing this, you keep each address type under the standard derivation path, so future recovery is as straightforward as possible.
I don't find that very "simple" and convenient, because you can't generate new adresses in your wallet neither use change adresses.  Undecided
Moreover it's not easy to create a P2SH wallet in Electrum. You have to do a hack AFAIK

The other option is to create a single wallet in Electrum, export the private keys you are interested in, and then import those private keys in to another Electrum wallet, using the same private key to generate one of each of the three above address types. The problem with this is you have to remember that you are using a private key from a "legacy" derivation path m/44'/0'/0'/0/0 to derive a P2WPKH address, for example.
I'm not sure about that, AFAIK Electrum use the common derivation path (m/0/0) for its legacy wallets, which is the same for its segwit wallets.

██
██
██
██
██
██
██
██
██
██
██
██
██
... LIVECASINO.io    Play Live Games with up to 20% cashback!...██
██
██
██
██
██
██
██
██
██
██
██
██
o_e_l_e_o
In memoriam
Legendary
*
Offline Offline

Activity: 2268
Merit: 18512


View Profile
March 24, 2021, 02:09:35 AM
 #17

I don't find that very "simple" and convenient, because you can't generate new adresses in your wallet neither use change adresses.  Undecided
Sure, it's not super straightforward, but it's the simplest method at present to achieve all address types from one seed phrase in a single wallet using Electrum.

Moreover it's not easy to create a P2SH wallet in Electrum. You have to do a hack AFAIK
Not if you are using a BIP39 seed phrase as I said. Then you just recover your seed phrase and select P2SH when prompted.

I'm not sure about that, AFAIK Electrum use the common derivation path (m/0/0) for its legacy wallets, which is the same for its segwit wallets.
For its own seed phrases, Electrum uses m/0 for legacy and m/0'/0 for segwit, but for BIP39 seed phrases it uses the standard BIP 44/49/84 paths.
LoyceV
Legendary
*
Offline Offline

Activity: 3304
Merit: 16654


Thick-Skinned Gang Leader and Golden Feather 2021


View Profile WWW
March 24, 2021, 09:45:16 AM
 #18

The simplest way of using the same seed for all the addresses is probably going to be to use a BIP39 seed with Electrum, import it three times to create three separate wallets - a P2PKH, a P2SH, and a P2WPKH wallet - and then export the individual private keys for each address you want and import them all in to the same wallet. You could also do something similar with a tool like Ian Coleman. By doing this, you keep each address type under the standard derivation path, so future recovery is as straightforward as possible.
Or, much easier, if you're looking for a HD wallet that allows to create all possible address type from one seed phrase: use Mycelium!
Right under the QR-code it shows: "Tap for P2PKH / Tap for P2SH / Tap for Bech32".

Mycelium has some drawbacks to consider though: it's not open source, only for mobile, and it can't send to multiple addresses at once. I use it as a mobile wallet, but only for small amounts, and I don't need "send to many" from mobile.

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!