Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: wsxdrfv on February 21, 2018, 08:00:07 AM



Title: What is pubkey?
Post by: wsxdrfv on February 21, 2018, 08:00:07 AM
python script GenesisH0, GenesisBlockZero, both does not work with newest bitcoin(0.15.1)/litecoin source.

When use those and compile, those just spit out error at assert line in chainparams.cpp script.

Those uses pubkey variable, so it means public key, right?

It just assume that key or provide, can I use it as-is?

Or how can I know my public key?

Should I generate it? How?


Title: Re: What is pubkey?
Post by: bob123 on February 25, 2018, 01:58:11 PM
python script GenesisH0, GenesisBlockZero, both does not work with newest bitcoin(0.15.1)/litecoin source.
When use those and compile, those just spit out error at assert line in chainparams.cpp script.
Those uses pubkey variable, so it means public key, right?
It just assume that key or provide, can I use it as-is?

You might start off with what you are trying to accomplish.
For me this is pretty confusing. Could you provide more information about what you did and what error message you got?



Or how can I know my public key?

The public key is derived from the private key.
pubK = G * privK
with pub = Public key; priv = private key; G = set of coordinates (x,y) on the secp256k1 elliptic curve
For more information about elliptic curve multiplication: https://en.wikipedia.org/wiki/Elliptic_Curve_DSA (https://en.wikipedia.org/wiki/Elliptic_Curve_DSA)



Should I generate it? How?

You definetely need to generate a public key if you want to receive payments.
You either use a wallet/script/tool to create a priv-/pub keypair or go code it yourself. What are you trying to accomplish?


Title: Re: What is pubkey?
Post by: wsxdrfv on February 25, 2018, 02:56:55 PM
python script GenesisH0, GenesisBlockZero, both does not work with newest bitcoin(0.15.1)/litecoin source.
When use those and compile, those just spit out error at assert line in chainparams.cpp script.
Those uses pubkey variable, so it means public key, right?
It just assume that key or provide, can I use it as-is?

You might start off with what you are trying to accomplish.
For me this is pretty confusing. Could you provide more information about what you did and what error message you got?



Or how can I know my public key?

The public key is derived from the private key.
pubK = G * privK
with pub = Public key; priv = private key; G = set of coordinates (x,y) on the secp256k1 elliptic curve
For more information about elliptic curve multiplication: https://en.wikipedia.org/wiki/Elliptic_Curve_DSA (https://en.wikipedia.org/wiki/Elliptic_Curve_DSA)



Should I generate it? How?

You definetely need to generate a public key if you want to receive payments.
You either use a wallet/script/tool to create a priv-/pub keypair or go code it yourself. What are you trying to accomplish?

Thx for reply.

So eventually I want to generate genesis block and make it work.

Some thread replies recommend using GenesisH0 at github ( https://github.com/lhartikk/GenesisH0 )for generate genesis block. So I tried, but when run it, it automatically provide some pubkey. I meant can I use as-is for my script? And where at my source code this pubkey should I input?

But anyway, these hash and nonce value got by GenesisH0 seems not work. When I input them to my code, spit out errors. (same assert errors when wrong hash value was input)

So I just used printf method to get hash, merkleroot value, this works, now I passed this step.

Now after this, I need to create genesis block, all the old codes does not work, and also need to pass "CheckProofOfWork" function at "pow.cpp" file.

I am stuck here. I used "CheckProofOfWork" function at chainparams.cpp with #include "pow.h" above, but compile spit out errors. Says there is no definition of CheckProofOfWork, maybe this is C++'s link problem, but I don't know how to solve this?

And is this right for use this Check... function to generating valid genesis block?


Title: Re: What is pubkey?
Post by: nullius on February 26, 2018, 01:40:21 AM
A public key is a large numerical value that is used to encrypt data. The key can be generated by a software program. It is provided by a designated authority and made available to everyone to send crypto.

A private key is for the owner and should never be shared!!!!!!!

WRONG INFORMATION, at least in the context of Bitcoin (and in some parts entirely incorrect).

The public keys in Bitcoin are used to sign data, not to encrypt data.  A digital signature from a private key is verifiable with a public key.  This provides authorization for a spend.

The key is not provided by a “designated authority”.  Not in Bitcoin, and not in any other reasonably designed public-key cryptosystem.  (In some other systems, such as TLS, an “authority” may certify public keys as being connected to a certain identity, such as a website address or (for EV) a corporate name; however, a TLS certificate authority does not generate the keys.)

The public key isn’t just a “large numerical value”.  It has specific properties which relate it to the private key.  For Bitcoin, read up on secp256k1 (https://en.bitcoin.it/wiki/secp256k1), the ECDSA (https://en.bitcoin.it/wiki/ECDSA) curve parameters used by Bitcoin.

The only correct line in this post:  A private key must never be shared.  The security of the whole system depends on the secrecy of the private key.  (This is an application of Kerckhoffs’ Principle.)



OP, you need to explain more clearly what you want.  bob123 said this already; and your followup post did little to elucidate.

Anyway, I don’t anticipate that I will follow this thread.  I only posted the foregoing because I saw incorrect factual statements, and there is already too much misinformation about there.  No need for newbies and learners to get confused by an authoritative-sounding wrong statement concerning the basic facts about public keys.  Happyniall, please don’t pretend to give answers unless you actually know what you’re talking about.  You will mislead other people.  Why bother?  Do you think anybody will give you credit for incorrect information in a technical forum?


Title: Re: What is pubkey?
Post by: wsxdrfv on February 26, 2018, 07:24:48 AM
So how to get key for genesisOutputScript variable in chainparams.cpp?

And is this public key of bitcoin?

const CScript genesisOutputScript = CScript() << ParseHex("dfalkdfjlefkjedf.............") << OP_CHECKSIG;



Title: Re: What is pubkey?
Post by: achow101 on February 26, 2018, 04:06:34 PM
So how to get key for genesisOutputScript variable in chainparams.cpp?
You generate it using whatever software you want. Most people use openssl. You could even just use an unmodified version of Bitcoin Core to do it. It doesn't matter what the public key is because that output is not spendable unless you have changed stuff in validation.cpp to make it spendable. Hell, the script could just be garbage too.

And is this public key of bitcoin?
It is an output script that contains a public key.


Title: Re: What is pubkey?
Post by: wsxdrfv on February 27, 2018, 12:58:27 AM
So how to get key for genesisOutputScript variable in chainparams.cpp?
You generate it using whatever software you want. Most people use openssl. You could even just use an unmodified version of Bitcoin Core to do it. It doesn't matter what the public key is because that output is not spendable unless you have changed stuff in validation.cpp to make it spendable. Hell, the script could just be garbage too.
 
Thanks.

Then how to make it spendable? What I have to changed in validation.cpp?