Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Update private_key.md#81

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
youngminpark2559 wants to merge72 commits intoProgrammingBlockchain:master
base:master
Choose a base branch
Loading
fromyoungminpark2559:master

Conversation

youngminpark2559
Copy link
Contributor

For not making readers confused by giving them the idea that Bitcoin secret and private key are separated things.

For not making readers confused by giving them the idea that Bitcoin secret and private key are separated things.
@NicolasDorier
Copy link
Collaborator

I agree, the turn of the sentence is a bit weird though.
I would have said

Bitcoin secret is nothing more than Private key represented in Base58Check

By getting Nicolas advice.
@youngminpark2559
Copy link
ContributorAuthor

Sir, how do you think that below content will be attached in "private key" section as a Tip?
There are some wrong idea? Or is this needless?
In Bitcoin, we don't put raw private key into wallet or transaction for security reason.
Instead, we hash and encode raw private key into some format such as Bitcoin Secret represented in Base58Check, and generally use private key in such format. But again, Bitcoin secret is nothing more than Private key represented in Base58Check.
Since this format of private key can be used with Wallet, Bitcoin Secret is also known as Wallet Import Format(WIF).
You can see the more details and uses in "spend your coins" section of this chapter.

I saw like that in BIP38 (Part 2) section.
@youngminpark2559
Copy link
ContributorAuthor

Please anyone tells me if it's something wrong or not.
In P2PK[H] (Pay to Public Key [Hash]) section, the sentence says We learned that a Bitcoin Address was the hash of a public key.
However, they're different like this:
Console.WriteLine(publicKeyHash); // 41e0d7ab8af1ba5452b824116a31357dc931cf28
Console.WriteLine(bitcoinAddress); // 171LGoEKyVzgQstGwnTHVh3TFTgo5PsqiY

@NicolasDorier
Copy link
Collaborator

Using Base58 does not increase security. It is just a standard to present and import public key in a human friendly way.

Code should normally useKey, and only useBitcoinSecret at the UI Layer.

But for preventing from being confused note that Bitcoin secret is nothing more than Private key represented in Base58Check.

This sentence is strange. Maybe should you add some punctuation or remove "But for preventing from being confused".

@NicolasDorier
Copy link
Collaborator

Bitcoin Address is the hash of the public key encoded in Base58.

Thank for explanations.I personally think that in that context, "But for preventing from being confused" is better placed there for understanding. So, I put a punctuation at the end of it.
Add contents about CombineSignatures()
@nopara73
Copy link
Contributor

@bokobza I resolved this conflict the same way we resolved back then. As you can see it didn't get resolved, just like back then. Do you remember what was the GitHub bug we encountered and how we solved it?

I was confused when I was first reading this section by Key privateKey = new Key(); // generate a random private keynew Key() can be said as a private key? I think it's more near to a kind of key object.So I edit that, if it's not appropriate, I will back to the original one.And I add some contents for giving background basics about Base64, Base58 etc.
Before sending the transaction to the network, examine the need of CombineSignatures() method.
Try to compare a full detail of transaction between bobSigned and fullySigned.
It will seem both are identical.
For this reason, it seems like the CombineSignatures() method is needless because mulit-signing has achieved without the CombineSignatures() method.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

typomulit

.BuildTransaction(sign: false);


Transaction aliceSigned =
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

identation

.AddKeys(alice)
.SignTransaction(unsignedNew);

Transaction bobSigned =
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

identation


The Base58Check encoding has some neat features, such as checksums to prevent typos and a lack of ambiguous characters such as '0' and 'O'.
The Base58Check encoding also provides a consistent way to determine the network of a given address; preventing a wallet from sending MainNet coins to a TestNet address.
## Encoindg schemes {# encoindg-schemes}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

typo Encoindg

@youngminpark2559
Copy link
ContributorAuthor

Thanks, Nicolas. I edited.
And I have a question.
In Multi Sig section, the words "multi-sig" and "ScriptPubKey" or the process of generating a ScriptPubKey don't make sense at the same time because sig means signing signature but generating a ScriptPubKey doesn't require signing signature but just a public key.
I think it's more appropriate that a ScriptPubKey is decorated by a kind of multi-publicKey rather than a multi-sig.

I wonder this.
Does the concept of multi-sig contain largely the following whole process?
1.Generating a ScriptPubKey by multiple publicKeys, and putting it into TxOut of an other getting coins transaction.
2.Proofing ownership of the recieved coins by multiple private keys or by multi-sig which is combined into one thing by multiple privatekeys.
3.Generating a scriptSig by processing multi-sig for a TxIn of a spending transaction.

@youngminpark2559
Copy link
ContributorAuthor

I also wonder this point.
1.
Can I solidify an idea that the process of generating a ScriptPubKey is eleminating a version byte which identifies a network type, and getting publicKey hash from a Bitcoin address(a version byte + a publicKey hash), and putting some script commands?

From above statement, can I consider the process of generating a Bitcoin address by a ScriptPubKey and network type as the same process of generating a Bitcoin address by a publicKey hash and network, except for direction(forwards for the latter, backwards for the former) and the fact that a ScriptPubKey only contains additional script commands, compared to a publicKey hash?

Can a ScriptPubKey be said as an address? Or can it be said as a value?
Got wondered from this sentence:
Notice the ScriptPubKey for testnet and mainnet address is the same ?

@NicolasDorier
Copy link
Collaborator

  1. yes byte array of 32 bytes

  2. Encoders.Hex.EncodeData("key.ToBytes()")

  3. Not sure what you mean, a key is needed for many operations in Bitcoin. BitcoinSecret is a Key + Network. In Bitcoin processing code, Network information is never needed.

@youngminpark2559
Copy link
ContributorAuthor

Thanks the review.
I tried this way.

I don't understand what you mean by Is it just a key object rather than specifying it as a private key

I thought this way,"Is it just a key object rather than specifying it as a private key?" or "Should it be named by keyObject rather than a privateKey?", when I was seeing this code:
Key privateKey = new Key();
So I thought readers would think this way too when they were seeing the code.
I'll change to the latter of the sentence which is more clear in the intention.

you instantiate a new object, not a class.

Fixed this way:
When you instantiate a Key object,

not necessarily true. On non-windows plateform it is untrue.

I think RNGCryptoServiceProvider things would be helpful for readers to understand widely, so I want to add explanations by your suggestion like this:
under the hood, in the case of .NET, you should invoke RNGCryptoServiceProvider to generate a key data and store it into a key object, which is a .NET wrapper around the Windows Cryto API. However, in the .NET, particular RNGCryptoServiceProvider is not mandatory, you can choose different generators you want to use. And also, since the RNGCryptoServiceProvider wouldn't work on the non-windows platform, you should choose appropriate generators on each platform.

@NicolasDorier
Copy link
Collaborator

I think RNGCryptoServiceProvider things would be helpful for readers to understand widely, so I want to add explanations by your suggestion like this:
under the hood, in the case of .NET, you should invoke RNGCryptoServiceProvider to generate a key data and store it into a key object, which is a .NET wrapper around the Windows Cryto API. However, in the .NET, particular RNGCryptoServiceProvider is not mandatory, you can choose different generators you want to use. And also, since the RNGCryptoServiceProvider wouldn't work on the non-windows platform, you should choose appropriate generators on each platform.

I prefer the book does not go into such details. People can easily look the source code, the only thing they need to know is that the default is using a secure RNG.

@youngminpark2559
Copy link
ContributorAuthor

youngminpark2559 commentedNov 21, 2017
edited
Loading

Okay, I agree on it and I'll keep that point in mind when I'm writing.
Fixed:
42ce6ed
284c111

I have some questions on the ScriptPubKey page:
https://github.com/ProgrammingBlockchain/ProgrammingBlockchain/blob/master/bitcoin_transfer/payment_script.md

Does that mean some ScriptPubKey doesn't contain the hashed public key like this?:
OP_DUP OP_HASH160 OP_EQUALVERIFY OP_CHECKSIG
And if the omitted hashed public key represents the recipient, what's the role of that ScriptPubKey without the recipient but just script commands which are conditions?

I understood like this.
ScriptPubKey is composed of both of script commands which are opcodes and hashed public key.
Script commands may play a role explaining the conditions which should be met to claim ownership of the coins.
Hashed public key related to corresponding public key and private key may play a role explaining the address for the recipient.

But this sentence:
A ScriptPubKey does not necessarily contain the hashed public key(s) permitted to spend the bitcoin.

Hashed public key is the thing permitting someone to spend the coin which is the task related to proof the ownership of the coin?

Under my understanding, I think hashed public key just represents the recipient like the address, not being related to some tasks of permitting coins.

ScriptPubKey seems like it doesn't have the network information because hashed public key doesn't have it.
Blockchain sees the ScriptPubKey as the address of recipient but how does Blockchain distinguish the kind of network?

@@ -4,8 +4,8 @@

A Blockchain is composed of blocks. And each block shapes the chain by referencing the previous block. A block is composed of a block header and transaction(s).

See the illustraion depicting a block and a blockchain, drawn by Youngmin Park, in the following link:

See the illustraion depicting a block and a blockchain, drawn by Youngmin Park(Youngmtool), in the following link:
Copy link
Collaborator

@NicolasDorierNicolasDorierNov 27, 2017
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

*illustraion typo, and a TxIn IS an input. This is not a different thing.

@youngminpark2559
Copy link
ContributorAuthor

@NicolasDorier
Thanks. Fixed. But of TxIn and input. That's the point I asked to@nopara73
But I'm still confused by the terms for them.

Hope you review this thread from top one by one and give the opinion:
#94

And if you don't mind, I want to hear about above question of ScriptPubKey.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@NicolasDorierNicolasDorierNicolasDorier left review comments

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@youngminpark2559@NicolasDorier@nopara73

[8]ページ先頭

©2009-2025 Movatter.jp