** Create Bech32 Add
ASS AR TRANSION from Bitcoin Cash (CH) to Ethereum Classic (etc), Mansers must convert their Bitcoins isding to Etherum classes using Bech32. In this article, we will be step by step with the process and provide the code in both ECDSA and ECDH.
Public Key ECDS
The process of the process, we briefly cover how to transport the ECDSA public key:
- Create a new private key surrounded by
ECDS_Generation_KeyyPair.
Bash
$ OPE SSEL ECPAM -out my_private_Key.PEM 4096
This will be a geneate 4096-bit private key.
- UP-PROPATE key to create a public education order:
`Bash
$ OpenSSL ECPARAM -in my_private_key.PEM PUUUBOUT -out my_public_KEY.PEM
This is explicitly at the output of the corresponding public key in PEM formats.
** Create Bech32 Add
Now that we have the ECDSA public key, let’s transport the “Ecrecover” command surviving “Bech32” and then “Bech32.
Here are the steps:
- Create a new command of surviving private keys
eCDS_generate_KeyPair (yourself as above):
Bash
$ OPE SSEL ECPAM -out my_private_Key.PEM 4096
2.
`Bash
$ OPESSL ECRECOVER Private for source my_private_key.pem -pubkey my_public_key.pey.inkey my_private_key.pem.pem.
This will issue a new public in the PEM format.
- Convert new public to Bech32 Estage
Bech32 Condocecommand (same as abov):
`Bash
$ bech32-endodode-type bech32 -o my_address.bech32 my_public_key.pem.pem.
This will issue a new fillet called my_address.bech32, but the Ethereum Class address corresponding to your ECDSA public key.
Code Examples
Here is the resort for examples in both ECDSA and ECDH:
ECDSA code
`python
Import ECC

Create new private keywords
Private_Key = ec.eckey.Generation (4096)
Upses private key
public_key = ec.ecplickey.from_private_Key (private_Key, 'my_private_key.pem')
Convert are a public key to the Bech32 formats Current command bech32-endodode (same as abov)
bech32_adrress = bech32.encode ('tage = bech32', 'o') + public_KEY.public_bytes (
Encoding = ecc.encoding.pem,
format = 'spki'
)
Print (bech32_address)
output: my_address.bech32
ECDH code
`Javacript
Const {ecdh} = require ('Crypto');
// Create a new command of the private keyword Surrowing_generation_KeyyPair.
Privatekey = ECDH.GenerateyyPair (4096);
// Use private original public
publickey = privatekey.publickey;
// convert public key to Bech32 formats using the Bech32-endodode command (the same as above)
Const Bech32address =Type = Bech32, O = $ Publickey.Publicbuytes (.Tobuffer ()};
Console.log (Bech32adress);
An example of the note code assumes that you have joined the installation of OpenSSL and get to know your commands. Keep in mind that Bech32 addresses may not always match Bitcoin’s cash in addresses due to different between ECDSA and ECDH.
