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

wip: solana native support #702

Draft
wants to merge 24 commits into
base: master
Choose a base branch
from
Draft

wip: solana native support #702

wants to merge 24 commits into from

Conversation

gomesalexandre
Copy link
Contributor

@gomesalexandre gomesalexandre commented Dec 19, 2024

Description

Includes:

  • Isolation layer groundwork
  • Address derivation (working, but with incorrect addresses because of secp256k1 elliptic curve vs. ed25519 Solana uses as a chain)
  • Signing (implemented, but broadcast is failing with Transaction signature verification failure because signing is using secp256k1 signature, which, even if you manage to sign with it, will be nope'd by the node)

TODO:

  • Add ed25519 elliptic curve support to native (most likely a new variant of BIP32 class, which uses ed25519 instead of secp256k1 with current BIP32 class)

Issue

Copy link

vercel bot commented Dec 19, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
hdwallet ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 23, 2024 8:10pm

@@ -57,5 +58,6 @@
"bs58": "^4.0.1",
"cosmjs-types": "^0.4.1",
"msw": "^0.27.1"
}
},
"gitHead": "a59c5a12b265b6f64c65920cf330358a250227c2"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

revert before opening me

@@ -245,6 +255,7 @@ export class NativeHDWallet
#deviceId: string;
#initialized = false;
#masterKey: Promise<Isolation.Core.BIP32.Node> | undefined = undefined;
#ed25519MasterKey: Promise<Ed25519Node> | undefined = undefined;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

since regular master key is a regular BIP32 node i.e seckp256k1 elliptic curve

@@ -15,6 +15,7 @@
},
"dependencies": {
"@bitcoinerlab/secp256k1": "^1.1.1",
"@noble/curves": "^1.4.0",
Copy link
Contributor Author

@gomesalexandre gomesalexandre Dec 23, 2024

Choose a reason for hiding this comment

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

note @noble/ed25519 is also available as a lightweight version but @noble/curves has more safety/features implemented

Comment on lines +53 to +54
// SLIP-0010 for Ed25519
const data = Buffer.concat([Buffer.from([0x00]), Buffer.from(this.#privateKey), indexBuffer]);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's the part we probably got wrong

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

Successfully merging this pull request may close these issues.

1 participant