Closed HeroHann closed 5 years ago
9f4e4c225894843a31338ed9164ebf31f280f2c8ac7015bfef2113354051ff91
is hex format of 256 bit private key.
Typically, private key is printed as wif format.
You can print wif format of private key in this way.
privateKey.toWIF()
Yes saw that sorry. ;D But thanks anyway!
Current behavior
I am just trying to get a PrivatKey for BTC Mainnet & a PublicKey & the corresponding Adress to this Private Key and fought this should do it:
let privateKey = PrivateKey(network: .mainnetBTC) let publicKey = privateKey.publicKey() let address = publicKey.toLegacy() print(privateKey) print(address)
I am getting this:
9f4e4c225894843a31338ed9164ebf31f280f2c8ac7015bfef2113354051ff91 1H97FP8nb7Q6yPnWH6MjKHryhkHsYDD2tt
Yes there is an Adress but this privatKey is not valid.
Is there a simple way to accomplish what I am searching for?