Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: beterhans on December 18, 2017, 04:19:10 PM



Title: Try to understand Segwit. I Found it's not easy...
Post by: beterhans on December 18, 2017, 04:19:10 PM
I've experienced network high fee and network congestion for 1 day can't get 1 confirmation.

So I'm searching for bitcoin segwit wallet.

What I found is no good wallet for it.

One is Electrum.
it's address is start with bc1 yeah it's great and it gave you private keys
BUT. blockchain.info can't search it's transaction.

seems like bc1 address is not compatible with old wallet and system.


another one is green address
yeah it's address start with 3 and compatible with other wallets and service
but it won't give you private key.
and even they give you private key it's no use.
Greenaddress is a Multisign wallet which need 2 private keys to move the funds.
I lost my rights on my coins.


So a few questions

1. is an address start with 3 is a multi sign address? that means you don't have full rights on you coins?
2. is an segwit address need to be a multi sign address?
3. which segwit wallet will give me the full right? (don't need others to approve)
4. if No.3 is no is that means segwit is a system that need someone to approve you transaction?



Title: Re: Try to understand Segwit. I Found it's not easy...
Post by: DannyHamilton on December 18, 2017, 05:01:15 PM
One is Electrum.
it's address is start with bc1 yeah it's great and it gave you private keys
BUT. blockchain.info can't search it's transaction.

seems like bc1 address is not compatible with old wallet and system.

Blockchain.info does not yet properly support SegWit.  Stop using blockchain.info and you won't have that problem.

1. is an address start with 3 is a multi sign address?

No.  An address that starts with 3 is a P2SH address.

P2SH can be used for multi-sig, but it can be used for other purposes as well (such as SegWit).

that means you don't have full rights on you coins?

That depends on the address.  If it is multi-sig and you don't have exclusive access to enough of the keys, then you don't have full rights.  If it is not multi-sig and/or you do have exclusive access to enough of the keys, then you do have full rights.

2. is an segwit address need to be a multi sign address?

No.  It can be, but is doesn't have to be.

3. which segwit wallet will give me the full right? (don't need others to approve)

Electrum is one.  There are probably others.  I haven't built a list yet.

4. if No.3 is no is that means segwit is a system that need someone to approve you transaction?

No.  SegWit does not require someone to approve your transactions.


Title: Re: Try to understand Segwit. I Found it's not easy...
Post by: beterhans on December 18, 2017, 05:11:57 PM
Electrum is one.  There are probably others.  I haven't built a list yet.
OK Thanks for the reply. that's awesome.

my next question is

is there any segwit wallet give you address start with 3 and not a multi-sig wallet and give you the private key?
seems electrum's address is not compatible with some other system.
some wallet or exchange may not able transfer to your address?

or
is there any segwit wallet allow you control a segwit paper wallet.


Title: Re: Try to understand Segwit. I Found it's not easy...
Post by: TryNinja on December 18, 2017, 06:23:37 PM
AFAIK you can use Segwit addresses starting with a 3 in Electrum.

That's what you need to do:
to have segwit addresses starting with a 3 in Electrum just follow these simple steps:

1) generate a bip39, 12 words seed on https://iancoleman.io/bip39/ (use it offline for more security)
2) on electrum choose, File -> New/Restore -> Standard Wallet -> I already have a seed -> click on "options" and choose bip39, write the seed then click next
3) on derivation path path use: m/49'/0'/0'/0

that's all. Remember to save in a safe place the seed as electrum will not show it (read below)

some wallet or exchange may not able transfer to your address?
Most major services still don't support addresses with the bech32 format.


Title: Re: Try to understand Segwit. I Found it's not easy...
Post by: nullius on December 18, 2017, 07:02:09 PM
Observe the address in my signature; as of this writing, it starts with a “3”.  That is a Segwit address.  It was generated by me, and is controlled only by me.

For Electrum, the following procedure for generating backward-compatible Segwit “3” addresses is tested by me.  See the linked references for more information.

As of version 3.0, released last month, Electrum does support Segwit!  You need to generate a new Electrum wallet for this; and if you select “Segwit wallet”, it will only give you Bech32 addresses.  If you want Bech32 addresses, then your problem is solved.  Bech32 addresses (https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki) are technically superior to old-style addresses; but they are not backward-compatible, so only people with Segwit support will be able to send you money.  I myself hope to switch to Bech32 in perhaps 6–12 months.  Future viewers of this post will see my signature showing an address which starts with “bc”.

To make Electrum give you a wallet of backward-compatible P2WPKH-nested-in-P2SH “3” addresses like the one you see now in my signature, use the following procedure, which I have tested:  (0) Generate a BIP39 seed by some other means.  I wrote a short C program for this, which I should polish up and post online; BIP 39 (https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki) itself contains a list of implementations, including the Python reference implementation (https://github.com/trezor/python-mnemonic).  (1) In the new wallet dialogue, tell Electrum that you already have a seed.  (2) In the seed entry dialogue, click the button for more options and tell Electrum you’re using a BIP39 seed.  (3) In the next screen, change the derivation path to m/49'/0'/0'.  The only part which needs to be changed is the “49”.  You may refer to BIP 49 (https://github.com/bitcoin/bips/blob/master/bip-0049.mediawiki) (as to the 49, the “purpose”) and BIP 44 (https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki) (for the two zeroes, “coin type” and “account”) to confirm that I am not giving you bad instructions which will send your money off into the weeds; I mention that because I’ve seen Internet posts get this part wrong.


Title: Re: Try to understand Segwit. I Found it's not easy...
Post by: Thirdspace on December 19, 2017, 12:55:03 PM
I hope OP doesn't mind if I join the discussion
when I generate new SegWit Address with coinb.in I get Segwit address, RedeemScript, Public key, Private key (WIF key)
with iancoleman.io bip49 derivation path, I get Address, Public Key and Private Key

but when creating new tx with segwit addresses,
I need RedeemScript to retrieve/redeem unspents and I also need private key to sign the transaction, correct?
so how do I see RedeemScript with iancoleman.io tool?

btw shouldn't segwit supposed to reduce tx size?
8ef03ebe095927da7e2d9b51d207424a3079ad045f3a64540a1667d87d5d551d (https://blockchain.info/tx/8ef03ebe095927da7e2d9b51d207424a3079ad045f3a64540a1667d87d5d551d) compressed to compressed + compressed = 225 (bytes)
735e692ff8e7334f2d51fa6ec14c83067f35ff387be6c46f6fa42ac511fa9fd1 (https://blockchain.info/tx/735e692ff8e7334f2d51fa6ec14c83067f35ff387be6c46f6fa42ac511fa9fd1) segwit to segwit + segwit = 247 (bytes)
or the second tx input is from multisig address?


Title: Re: Try to understand Segwit. I Found it's not easy...
Post by: pebwindkraft on December 19, 2017, 05:16:21 PM
btw shouldn't segwit supposed to reduce tx size?
8ef03ebe095927da7e2d9b51d207424a3079ad045f3a64540a1667d87d5d551d (https://blockchain.info/tx/8ef03ebe095927da7e2d9b51d207424a3079ad045f3a64540a1667d87d5d551d) compressed to compressed + compressed = 225 (bytes)
735e692ff8e7334f2d51fa6ec14c83067f35ff387be6c46f6fa42ac511fa9fd1 (https://blockchain.info/tx/735e692ff8e7334f2d51fa6ec14c83067f35ff387be6c46f6fa42ac511fa9fd1) segwit to segwit + segwit = 247 (bytes)
or the second tx input is from multisig address?

I can't see, that the second is multisig. It's tx sig looks like this:

Code:
WITNESS TXIN[0] stack elements: hex=02, decimal=2
 WITNESS[0] data length (var_int), hex=47, decimal=71, data(uchar[]):  3044022027BAC51C3DF47B8C3396D5C2CAE52A272D1B4EB7C02A45465B6D071823469EE202201C349BF199C0A0CFF8F3ED88448B2B6D518EA8298C5803E333ACB8543A0088E901
 WITNESS[1] data length (var_int), hex=21, decimal=33, data(uchar[]):
  03F42E8010475E2AF03E8AE790C956AD40945FA7C57740FA839FBC6ADF89F5376C

WITNESS [0] decodes to a single sig, with R+S key, and then SIGHASH_ALL:
  ##################################################################
  ### tcls_in_sig_script.sh: decode SIG_script OPCODES from a TX ###
  ##################################################################
    47: OP_DATA_0x47:        push hex 47 (decimal 71) bytes on stack
    30: OP_SEQUENCE_0x30:    type tag indicating SEQUENCE, begin sigscript
    44: OP_LENGTH_0x44:      length of R + S
    02: OP_INT_0x02:         type tag INTEGER indicating length
    20: OP_LENGTH_0x20:      this is SIG R (32 Bytes)
        27BAC51C3DF47B8C:3396D5C2CAE52A27
        2D1B4EB7C02A4546:5B6D071823469EE2
    02: OP_INT_0x02:         type tag INTEGER indicating length
    20: OP_LENGTH_0x20:      this is SIG S (32 Bytes)
        1C349BF199C0A0CF:F8F3ED88448B2B6D
        518EA8298C5803E3:33ACB8543A0088E9
    01: OP_SIGHASHALL:       this terminates the ECDSA signature (ASN1-DER structure)

curious to see, how this is explained...


Title: Re: Try to understand Segwit. I Found it's not easy...
Post by: tublo on December 20, 2017, 12:17:19 AM
Electrum is one.  There are probably others.  I haven't built a list yet.
OK Thanks for the reply. that's awesome.

my next question is

is there any segwit wallet give you address start with 3 and not a multi-sig wallet and give you the private key?
seems electrum's address is not compatible with some other system.
some wallet or exchange may not able transfer to your address?

or
is there any segwit wallet allow you control a segwit paper wallet.


Samourai wallet supports segwit address starting with 3.


Title: Re: Try to understand Segwit. I Found it's not easy...
Post by: william8829 on December 20, 2017, 01:10:37 AM
So I'm searching for bitcoin segwit wallet.

Heres an article that will help illuminate a couple of things about segwit wallets. Like why, how and which ones should I use.

https://hackernoon.com/bitcoin-owners-you-need-to-do-these-two-things-right-now-a73122dd23d4

Here is a pic that summarizes things very well I found on hackernoons twitter.

https://i.imgur.com/fvpXUAl.png?1


https://twitter.com/hackernoon