-
Notifications
You must be signed in to change notification settings - Fork 72
How to create a key from openssl
openssl ecparam -genkey -name secp256k1 -out somekey.pem
openssl ec -in somekey.pem -text > somekey.hex
cat somekey.hex
~ $ cat somekey.hex
Private-Key: (256 bit)
priv:
2b:74:25:70:12:b6:4a:1d:de:ae:da:24:13:b2:cf:
1e:89:16:f9:79:85:98:a5:15:07:8f:76:c3:f6:7d:
06:78
pub:
04:6a:28:3b:e4:7c:94:7a:24:ae:ca:33:0a:6a:0d:
44:6e:db:0a:92:d2:67:96:f6:43:ad:49:10:71:19:
d9:9b:9b:df:76:bf:31:b9:3b:85:aa:84:f0:67:dc:
4d:d0:0b:d3:a9:d4:0c:a2:73:f2:5d:72:b3:3b:aa:
04:5c:48:57:b1
ASN1 OID: secp256k1
-----BEGIN EC PRIVATE KEY-----
MHQCAQEEICt0JXAStkod3q7aJBOyzx6JFvl5hZilFQePdsP2fQZ4oAcGBSuBBAAK
oUQDQgAEaig75HyUeiSuyjMKag1EbtsKktJnlvZDrUkQcRnZm5vfdr8xuTuFqoTw
Z9xN0AvTqdQMonPyXXKzO6oEXEhXsQ==
-----END EC PRIVATE KEY-----
!!! PLEASE DO NOT USE THIS KEY FOR SENDING OR RECEIVING ANY FUNDS, CREATE YOUR OWN !!!
2b74257012b64a1ddeaeda2413b2cf1e8916f9798598a515078f76c3f67d0678
046a283be47c947a24aeca330a6a0d446edb0a92d26796f643ad49107119d99b9bdf76bf31b93b85aa84f067dc4dd00bd3a9d40ca273f25d72b33baa045c4857b1
C7 2b74257012b64a1ddeaeda2413b2cf1e8916f9798598a515078f76c3f67d0678
echo C72b74257012b64a1ddeaeda2413b2cf1e8916f9798598a515078f76c3f67d0678 | xxd -r -p > temp
openssl dgst -sha256 temp
SHA256(temp)= 241a48a364d0276e48254826454cb9e10cca665d68b2f8262d9c366792cfc373
echo 241a48a364d0276e48254826454cb9e10cca665d68b2f8262d9c366792cfc373 | xxd -r -p > temp2
openssl dgst -sha256 temp2
SHA256(temp2)= 8957e8e264eca431b445b0ae8fa9b197c0445d0e8fc6b0dc83c49edff702cd09
Append the Checksum bytes to the prefix-extended key (thats your private key with prefix byte) (first 4 bytes of second temp2 hash is the checksum)
C7 2b74257012b64a1ddeaeda2413b2cf1e8916f9798598a515078f76c3f67d0678 8957e8e2
run mit scheme to get your WIF key for your wallet (if you dont have it installed, run sudo apt-get install mit-scheme
)
run in terminal mit-scheme
(define (base58check input)
(define (base58digit k) (string-ref "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz" k))
(define (extractdigits n digits)
(if (> 58 n)
(list->string (cons (base58digit n) digits))
(extractdigits (quotient n 58) (cons (base58digit (modulo n 58)) digits))))
(extractdigits input '()))
(base58check #xC72b74257012b64a1ddeaeda2413b2cf1e8916f9798598a515078f76c3f67d06788957e8e2)
This is now private key for wagerr (WIF-Key) which is calculated from openssl private key. The result is:
;Value 13: "7gAH5C7oNDBgrD6jSS6L31Bew66hDt86pBA3vTHHp1s8pbY8b7w"
import key with: importprivkey 7gAH5C7oNDBgrD6jSS6L31Bew66hDt86pBA3vTHHp1s8pbY8b7w "TestOpensslKey" false
which has wagerr public address: WfV31B4L3E5cm1JTGykFcMyAFGT5budMjb
run validation from daemon or qt: validateaddress WfV31B4L3E5cm1JTGykFcMyAFGT5budMjb
Result:
{
"isvalid": true,
"address": "WfV31B4L3E5cm1JTGykFcMyAFGT5budMjb",
"ismine": true,
"iswatchonly": false,
"isscript": false,
"pubkey": "046a283be47c947a24aeca330a6a0d446edb0a92d26796f643ad49107119d99b9bdf76bf31b93b85aa84f067dc4dd00bd3a9d40ca273f25d72b33baa045c4857b1",
"iscompressed": false,
"account": "TestOpensslKey"
}
If address is valid, then you may start using it for deposit/withrawals. You can verify also the pubkey
value if it matches public key from your somekey.hex
.
Home - https://wagerr.com
Discord - https://discord.gg/tkcXS34
Telegram - https://t.me/wagerrcoin
Support - support@wagerr.com