Sign Ed25519
Ed25519 is a widely adopted digital signature algorithm known for its strong security and efficiency. Signing with Ed25519 ensures data integrityAssurance that the data stored in the ledger has not been tampered with or altered in any unauthorized way., authenticity, and non-repudiation. When signing with Ed25519, a private key generates a digital signature that can be verified with the corresponding public key. This process guarantees that the data has not been tampered with and originated from the private key's holder.
Example Code
- Rust
- Typescript (Node.js)
- Python
- Create a
StrongholdSecretManager
with theSTRONGHOLD_PASSWORD
andMNEMONIC
variables in your.env
file.
- Use the
SecretManager
to sign theFOUNDRY_METADATA
message as bytes using theStrongholdAdapter.sign_ed25519()
function.
- Hash the public key to get the address using the
hex_public_key_to_bech32_address()
function.
- Create a
StrongholdSecretManager
with theSTRONGHOLD_PASSWORD
andMNEMONIC
variables in your.env
file.
- Use the
SecretManager
to sign theFOUNDRY_METADATA
message as bytes using theSecretManager.signEd25519()
function.
- Hash the public key to get the address using the
Utils.hexPublicKeyToBech32Address()
function.
- Create a
StrongholdSecretManager
with theSTRONGHOLD_PASSWORD
andMNEMONIC
variables in your.env
file.
- Use the
SecretManager
to sign theFOUNDRY_METADATA
message as bytes using theSecretManager.sign_ed25519()
function.
- Hash the public key to get the address using the
Utils.hex_public_key_to_bech32_address()
function.
Full Example Code
- Rust
- Typescript (Node.js)
- Python
sdk/examples/how_tos/sign_and_verify_ed25519/sign_ed25519.rs
loading...
bindings/nodejs/examples/how_tos/sign_and_verify_ed25519/sign-ed25519.ts
loading...
bindings/python/examples/how_tos/sign_and_verify_ed25519/sign_ed25519.py
loading...
Expected Output
Public key: 0x67b7fc3f78763c9394fc4fcdb52cf3a973b6e064bdc3defb40a6cb2c880e6f5c
Signature: 0x5437ee671f182507103c6ae2f6649083475019f2cc372e674be164577dd123edd7a76291ba88732bbe1fae39688b50a3678bce05c9ef32c9494b3968f4f07a01
Address: rms1qpllaj0pyveqfkwxmnngz2c488hfdtmfrj3wfkgxtk4gtyrax0jaxzt70zy