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

Create account with threshold key #2579

Merged

Conversation

b-l-u-e
Copy link
Contributor

@b-l-u-e b-l-u-e commented Oct 14, 2024

Description:
This PR introduces an example for creating an account with a threshold key in the Hedera JavaScript SDK, which mirrors the existing example in the Hedera Java SDK.

Problem
The Hedera Java SDK already includes an example (CreateAccountThresholdKeyExample.java) that demonstrates how to create an account with a threshold key. This feature is essential for ensuring security by requiring multiple signatures to authorize transactions.

However, there is currently no such example in the Hedera JavaScript SDK. Developers using the JavaScript SDK would greatly benefit from a similar example to guide them through creating accounts with threshold keys in JavaScript, as it's a crucial security feature.

Solution

This PR provides a new example in the JavaScript SDK that follows the structure of the existing Java example. Key steps include:

  • Generating key pairs using PrivateKey.generateED25519().
  • Initializing a KeyList with a threshold and adding public keys to create the threshold key.
  • Creating an account using the threshold key.
  • Demonstrating a transaction that requires multiple signatures from the threshold key.
  • Cleaning up by deleting the account, again requiring multi-signatures.

Related issue(s):

Fixes #2511

Signed-off-by: b-l-u-e <winnie.gitau282@gmail.com>
Copy link

codecov bot commented Oct 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.46%. Comparing base (734aa62) to head (740d567).
Report is 16 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2579      +/-   ##
==========================================
+ Coverage   84.43%   84.46%   +0.02%     
==========================================
  Files         283      283              
  Lines       71038    71088      +50     
==========================================
+ Hits        59981    60044      +63     
+ Misses      11057    11044      -13     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@ivaylogarnev-limechain ivaylogarnev-limechain left a comment

Choose a reason for hiding this comment

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

Thank you for your efforts! With those comments addressed the exampled would have finished look.

examples/create-account-with-thresholdkey.js Outdated Show resolved Hide resolved
examples/create-account-with-thresholdkey.js Outdated Show resolved Hide resolved
examples/create-account-with-thresholdkey.js Show resolved Hide resolved
examples/create-account-with-thresholdkey.js Show resolved Hide resolved
examples/create-account-with-thresholdkey.js Outdated Show resolved Hide resolved
examples/create-account-with-thresholdkey.js Outdated Show resolved Hide resolved
examples/create-account-with-thresholdkey.js Outdated Show resolved Hide resolved
examples/create-account-with-thresholdkey.js Outdated Show resolved Hide resolved
examples/create-account-with-thresholdkey.js Outdated Show resolved Hide resolved
…plemented logger

Signed-off-by: b-l-u-e <winnie.gitau282@gmail.com>
Signed-off-by: b-l-u-e <winnie.gitau282@gmail.com>
Signed-off-by: b-l-u-e <winnie.gitau282@gmail.com>
Signed-off-by: b-l-u-e <winnie.gitau282@gmail.com>
@b-l-u-e
Copy link
Contributor Author

b-l-u-e commented Oct 16, 2024

@ivaylogarnev-limechain updated file used Logger and Loglevel from @hashgraph/sdk instead of javascript

Signed-off-by: b-l-u-e <winnie.gitau282@gmail.com>
Signed-off-by: b-l-u-e <winnie.gitau282@gmail.com>
Copy link

Copy link
Contributor

@ivaylogarnev-limechain ivaylogarnev-limechain left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for your efforts!

@b-l-u-e
Copy link
Contributor Author

b-l-u-e commented Oct 17, 2024

@agadzhalov @rwalworth

Copy link
Contributor

@agadzhalov agadzhalov left a comment

Choose a reason for hiding this comment

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

LGTM

@b-l-u-e
Copy link
Contributor Author

b-l-u-e commented Oct 17, 2024

@rwalworth please approve

@b-l-u-e
Copy link
Contributor Author

b-l-u-e commented Oct 22, 2024

for this PR some checks failed:
Build & Test / Test using Node 16 (pull_request)
codecov/project
please advice @ivaylogarnev-limechain

@ivaylogarnev-limechain
Copy link
Contributor

for this PR some checks failed: Build & Test / Test using Node 16 (pull_request) codecov/project please advice @ivaylogarnev-limechain

Which pull request are you referring to? The current one looks good.

@b-l-u-e
Copy link
Contributor Author

b-l-u-e commented Oct 22, 2024

its okay now before it was showing some checks didn't pass
thank you for reaching out. I appreciate it @ivaylogarnev-limechain

@agadzhalov agadzhalov merged commit 3fbcaac into hiero-ledger:main Oct 25, 2024
9 checks passed
This was referenced Oct 29, 2024
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.

Create an Example for "Create Account with Threshold Key" functionality
3 participants