Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The Last Bikeshed #11

Open
coolaj86 opened this issue Feb 3, 2023 · 2 comments
Open

The Last Bikeshed #11

coolaj86 opened this issue Feb 3, 2023 · 2 comments

Comments

@coolaj86
Copy link
Member

coolaj86 commented Feb 3, 2023

Name Type Property Function Argument / Variable
Buffer Uint8Array - toBytes() bytes
Address Address address toAddr() addr / payAddr / changeAddr
- AddressToPubKeyHash - addrToPkh() -
Public Key PublicKey publicKey toPublicKey() pubBytes / pubHex
- PublicKeyToPubKeyHash - pubkeyToPkh() -
PubKey Hash PubKeyHash pubKeyHash toPkh() pkh
Private Key PrivateKey privateKey toPrivKey() privBytes / privHex
Sighash Type SighashType sighashType - sighashByte

1. Descriptive Type and Property Names

public_key and publicKey are fantastic property names. Descriptive. Easy-to-read. Wonderful.

And PublicKeyToPubKeyHash is a fine Type name. It's very descriptive. When it pops up with Tooling, it makes sense.

2. Functions, however, need shorter names

DashKeys.publicKeytoPublicKeyHash(pubBytes) is not only long, it's actually hard to read.

DashKeys.pubKeyToPkh(pubBytes) is actually easier to see at-a-glance.

3. Is it pubKey or pubkey?

It's definitely either public_key (JSON, DB) or publicKey (code).

I'm not so sure when it comes to functions though...

It's actually easier to distinguish between pubkeyToPkh than pubKeytoPkh - too many humps vying for attention isn't as easy to read as fewer humps.

4. This is an ecosystem concern

  • Dash Keys
  • Dash HD
  • Dash Tx
  • Dash Wallet

I want the exact same styles across the entire ecosystem.

  • All functions are stylized like X
  • All function arguments are stylized like X'(?)
  • All properties are stylized like Y
  • All types are stylized like Z
@coolaj86
Copy link
Member Author

coolaj86 commented Feb 4, 2023

  • bring toPublicKey() up a level to DashKeys.toPubkey()
  • bring in sign() and verify()
    (DashKeys will be the common abstraction over secp256k1)

@coolaj86
Copy link
Member Author

SIGHASH_TYPE seems like it should translate to SighashType and sighashType, but I think I picked up sigHashType from somewhere Core-ish or Insight-ish. I need to trace that back to make a final decision.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant