hedera-sdk-js icon indicating copy to clipboard operation
hedera-sdk-js copied to clipboard

Create account with threshold key

Open b-l-u-e opened this issue 1 year ago • 8 comments

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

b-l-u-e avatar Oct 14 '24 12:10 b-l-u-e

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

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     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Oct 14 '24 13:10 codecov[bot]

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

b-l-u-e avatar Oct 16 '24 13:10 b-l-u-e

@agadzhalov @rwalworth

b-l-u-e avatar Oct 17 '24 10:10 b-l-u-e

@rwalworth please approve

b-l-u-e avatar Oct 17 '24 15:10 b-l-u-e

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

b-l-u-e avatar Oct 22 '24 11:10 b-l-u-e

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.

ivaylogarnev-limechain avatar Oct 22 '24 13:10 ivaylogarnev-limechain

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

b-l-u-e avatar Oct 22 '24 13:10 b-l-u-e