Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: Many Coins on February 13, 2018, 04:38:17 PM



Title: How can create a new pszMainKey? (alert key)
Post by: Many Coins on February 13, 2018, 04:38:17 PM
Hello!

How can I create a new pszMainKey on Bitcoin Core 0.8?

Code:
static const char* pszMainKey = "04fc9702847840aaf195de8442ebecedf5b095cdbb9bc716bda9110971b28a49e0ead8564ff0db22209e0374782c093bb899692d524e9d6a6956e7c5ecbcd68284";

on Ubuntu 16.04 for example

Thank you.


Title: Re: How can create a new pszMainKey? (alert key)
Post by: achow101 on February 13, 2018, 07:09:08 PM
Install openssl and run this command:

Code:
openssl genpkey -algorithm ec -outform der -pkeyopt ec_paramgen_curve:secp256k1 -text

You should get output that looks like this:
Code:
priv:
    7a:b0:fa:87:78:00:2e:01:cb:03:d2:c3:3a:89:e7:
    e2:1e:b2:06:e8:cc:4f:04:2f:26:d1:96:d0:92:4a:
    32:2a
pub:
    04:29:ff:48:50:d3:3f:2c:a4:0d:fb:86:12:f4:5c:
    fc:d2:92:58:ca:01:38:12:8f:25:90:17:23:d8:ad:
    6e:66:b4:ce:87:ea:9c:1a:93:ed:22:87:ef:a9:b4:
    4d:92:45:39:87:26:84:93:7b:db:2c:75:9f:29:10:
    a1:cd:4c:0e:32
Field Type: prime-field
Prime:
    00:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:
    ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:fe:ff:
    ff:fc:2f
A:    0
B:    7 (0x7)
Generator (uncompressed):
    04:79:be:66:7e:f9:dc:bb:ac:55:a0:62:95:ce:87:
    0b:07:02:9b:fc:db:2d:ce:28:d9:59:f2:81:5b:16:
    f8:17:98:48:3a:da:77:26:a3:c4:65:5d:a4:fb:fc:
    0e:11:08:a8:fd:17:b4:48:a6:85:54:19:9c:47:d0:
    8f:fb:10:d4:b8
Order:
    00:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:
    ff:fe:ba:ae:dc:e6:af:48:a0:3b:bf:d2:5e:8c:d0:
    36:41:41
Cofactor:  1 (0x1)

The hex under pub is what you put for pszMainKey. The hex under priv is the private key. Keep that somewhere safe. When you enter the hex, make sure you remove the colons (:) and the line breaks.



Note that the alert system has a number of DoS vulnerabilities and was removed from Bitcoin.


Title: Re: How can create a new pszMainKey? (alert key)
Post by: Many Coins on February 13, 2018, 07:21:31 PM
Install openssl and run this command:

Code:
openssl genpkey -algorithm ec -outform der -pkeyopt ec_paramgen_curve:secp256k1 -text

....



Note that the alert system has a number of DoS vulnerabilities and was removed from Bitcoin.

WOW! It's working! Thank you!