Author

Topic: How to create a Bech32 (bc1) address with PHP standalone? (Read 320 times)

full member
Activity: 203
Merit: 168
Bitwasp is not of much help in this regard.

I'm not sure why you say this.  bitwasp has a bech32 example.

 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.
legendary
Activity: 1042
Merit: 2805
Bitcoin and C♯ Enthusiast
Ok. So, what would be the Bech32 (bc1) address derived from the following?
Private Key(Hex): C070A5ECF7138485E5FBC3561BC43D0C3C6052397768B1A7CB996444E8CB917D
Public Key(Compressed): 0228B2993B17F77EB967F3761F72B6B35E4B5C229D5208771F4C9154C42CE7CC13
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.
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)
sr. member
Activity: 860
Merit: 423
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.
Ok. So, what would be the Bech32 (bc1) address derived from the following?

Private Key(Hex): C070A5ECF7138485E5FBC3561BC43D0C3C6052397768B1A7CB996444E8CB917D

Public Key(Compressed): 0228B2993B17F77EB967F3761F72B6B35E4B5C229D5208771F4C9154C42CE7CC13

Any step by step instruction similar to this, will be of great help.
https://bitcointalksearch.org/topic/step-by-step-guide-to-go-from-public-key-to-a-bech32-encoded-address-4992632
Step 0 for you would be to get the public key from private key as you would any other time (private key * G).
Fantastic guide. Do you know any PHP code, which does this?
legendary
Activity: 1042
Merit: 2805
Bitcoin and C♯ Enthusiast
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, will be of great help.
https://bitcointalksearch.org/topic/step-by-step-guide-to-go-from-public-key-to-a-bech32-encoded-address-4992632
Step 0 for you would be to get the public key from private key as you would any other time (private key * G).
sr. member
Activity: 860
Merit: 423
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, will be of great help.
Jump to: