Closed jholdstock closed 5 years ago
I assume the equivalents for testnet also exist: Tk Ts Tc
Have taken a stab at rewording @davecgh 's definition of an address, from the perspective of someone whose brain is hurting trying to understand the concept of an address (i.e. me).
A human-readable representation of a possible destination for a payment, similar to an email address. Unlike an email address however, there are a variety of address types, and most addresses are intended only for a single use. This is because addresses represent not only the destination of a payment, but constraints required to redeem funds. For the most common type of transaction, the address requires only that the recipient sign the transaction using a hash of their public key. Other address types require signatures from multiple parties (multi-sig), signatures created within specified time limits, or other more complex constraints.
The signature is not using the hash of the public key, rather it uses the private key that corresponds to the public key, and that public key must hash to the same hash the address requires. Further, the public key itself must also be provided.
Maybe:
For the most common type of address, the constraints require that the recipient provide both the public key which hashes to the requisite hash and a valid signature that is created from the corresponding private key.
I think I get it now. Reads well when I drop your sentence in.
A human-readable representation of a possible destination for a payment, similar to an email address. Unlike an email address however, there are a variety of address types, and most addresses are intended only for a single use. This is because addresses represent not only the destination of a payment, but constraints required to redeem funds. For the most common type of address, the constraints require that the recipient provide both the public key which hashes to the requisite hash and a valid signature that is created from the corresponding private key. Other address types require signatures from multiple parties (multi-sig), signatures created within specified time limits, or other more complex constraints.
Reopening - we still haven't covered the various address types.
Have taken a stab at defining address types (below). However, I'm hesitant to add this to the address definition in the glossary. Our current address definition is already pretty long. This is starting to feel like a separate piece of content. Perhaps we can create a page under Advanced for addresses, similar to the Block Header Specifications page?
Decred addresses can be identified by their 2-byte prefix. The first byte identifies the network. The second byte identifies the address type. For the first byte, ‘D’ means the address is a mainnet address, ’T’ means it's a testnet address, and ’S’ means it's a simnet address. For the second byte, the most common address types are ‘k’ = p2pk, ’s’ = secp256k1 p2pkh, and ‘k’ = p2pk. For example, the most common address used on mainnet starts with ‘Ds’ (i.e. Alice sends Bob some DCR). Addresses used by Voting Service Providers (VSPs) on mainnet are typically ‘Dc’ addresses, since they require an address type that supports multi-sig.
This issues seems like the place to put this. I was looking though https://github.com/decred/dcrd/tree/master/chaincfg out of curiosity and made this table below:
Address Type | Locking Script | Mainnet | Testnet | Simnet | Regnet | Prefix Size (byte) |
---|---|---|---|---|---|---|
Pay-to-Pubkey | P2Pk | Dk | Tk | Sk | Rk | 2 |
Pay-to-PubkeyHash | P2PKH | Ds | Ts | Ss | Rs | 2 |
Pay-to-PubkeyHash (Edwards Address ID) | P2PKH | De | Te | Se | Re | 2 |
Pay-to-PubkeyHash (secp256k1 Schnorr Address ID) | P2PKH | DS | TS | SS | RS | 2 |
Pay-to-Script-Hash | P2SH | Dc | Tc | Sc | Rc | 2 |
Wallet Import format (Private Key ID) | WIF | Pm | Pt | Ps | Pr | 2 |
Hierarchical deterministic (Private Key ID) | HD | dprv | tprv | sprv | rprv | 4 |
Hierarchical deterministic (Public Key ID) | HD | dpub | tpub | spub | rpub | 4 |
Im thinking we could show a table like this in the docs (omit addresses not used like Edwards, Schnorr,WIF, HD) under question 7 or 8 (https://docs.decred.org/faq/wallets-and-seeds/)? I will open a seperate issue for editing this page.
Address Type | Locking Script | Mainnet | Testnet | Prefix Size (byte) | Example Address |
---|---|---|---|---|---|
Pay-to-Pubkey | P2Pk | Dk | Tk | 2 | |
Pay-to-PubkeyHash | P2PKH | Ds | Ts | 2 | |
Pay-to-Script-Hash | P2SH | Dc | Tc | 2 |
This is great @zubairzia0 . I will say again though, I think we now have enough technical detail on addresses that we should create a separate page. This is too much detail for a FAQ entry, or glossary entry. I'm thinking we create something similar to the Block Header Specifications page under /Advanced. We can then link to this page from the FAQ and the glossary.
More content on this topic: https://forum.decred.org/threads/hosting-stake-pools.1321/page-2#post-14995
@jholdstock , the forum text is good, and I think we should port it over to dcrdocs in some form. Now that we have a good deal of technical information on addresses, I think it makes the most sense to have an address page under /Advanced, which we can link to from the address definition and other places. Have made my case for this in the below issue, https://github.com/decred/dcrdocs/issues/779
Dave C mentioned various address types and their associated prefixes here: https://github.com/decred/dcrdocs/pull/675#discussion_r235489109
Might be a nice detail to mention somewhere.