Title: How to create a Bech32 (bc1) address with PHP standalone? Post by: 100bitcoin on April 24, 2019, 11:48:58 PM Bitwasp is not of much help in this regard.
Can these addresses be derived from legacy private key? Any step by step instruction similar to this (https://bitcointalk.org/index.php?topic=919430.msg10101533#msg10101533), will be of great help. Title: Re: How to create a Bech32 (bc1) address with PHP standalone? Post by: Coding Enthusiast on April 25, 2019, 03:14:24 AM Can these addresses be derived from legacy private key? There is no such thing as "legacy private key". There has always been 1 type of private key, which is a number from 1 to curve's n-1.Any step by step instruction similar to this (https://bitcointalk.org/index.php?topic=919430.msg10101533#msg10101533), will be of great help. https://bitcointalk.org/index.php?topic=4992632.0Step 0 for you would be to get the public key from private key as you would any other time (private key * G). Title: Re: How to create a Bech32 (bc1) address with PHP standalone? Post by: 100bitcoin on April 25, 2019, 06:36:07 PM Can these addresses be derived from legacy private key? There is no such thing as "legacy private key". There has always been 1 type of private key, which is a number from 1 to curve's n-1.Private Key(Hex): C070A5ECF7138485E5FBC3561BC43D0C3C6052397768B1A7CB996444E8CB917D Public Key(Compressed): 0228B2993B17F77EB967F3761F72B6B35E4B5C229D5208771F4C9154C42CE7CC13 Any step by step instruction similar to this (https://bitcointalk.org/index.php?topic=919430.msg10101533#msg10101533), will be of great help. https://bitcointalk.org/index.php?topic=4992632.0Step 0 for you would be to get the public key from private key as you would any other time (private key * G). Title: Re: How to create a Bech32 (bc1) address with PHP standalone? Post by: Coding Enthusiast on April 25, 2019, 07:16:00 PM Ok. So, what would be the Bech32 (bc1) address derived from the following? You can use https://segwitaddress.org/bech32/ to test things on the web (it only accepts WIFs which you can convert from hex using bitaddress.org) or use any wallet that supports importing keys and Bech32 addresses.Private Key(Hex): C070A5ECF7138485E5FBC3561BC43D0C3C6052397768B1A7CB996444E8CB917D Public Key(Compressed): 0228B2993B17F77EB967F3761F72B6B35E4B5C229D5208771F4C9154C42CE7CC13 This would be the resulting address: Code: bc1qemht6dcq0cxkam9z7f9lyqwztqtr5c7zszu2f9 Fantastic guide. Do you know any PHP code, which does this? No, but a search on GitHub returns one result: https://github.com/Bit-Wasp/bech32 (use at your own risk)Title: Re: How to create a Bech32 (bc1) address with PHP standalone? Post by: danda on May 01, 2019, 03:25:39 PM Bitwasp is not of much help in this regard. I'm not sure why you say this. bitwasp has a bech32 example (https://github.com/Bit-Wasp/bitcoin-php/blob/master/examples/zpub.create.php). hd-wallet-derive (https://github.com/dan-da/hd-wallet-derive) uses bitwasp and spits out bech32 as well as p2sh and legacy addresses for a given key. You can check the source if you like. I do think that bitwasp makes it harder than need be. See this issue (https://github.com/Bit-Wasp/bitcoin-php/issues/720). |