diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 515ea62af4..4ed4d992c4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -217,8 +217,8 @@ jobs: - name: Set Operator Account run: | - echo "OPERATOR_KEY=${{ steps.solo.outputs.ed25519PrivateKey }}" >> $GITHUB_ENV - echo "OPERATOR_ID=${{ steps.solo.outputs.ed25519AccountId }}" >> $GITHUB_ENV + echo "OPERATOR_KEY=${{ steps.solo.outputs.ecdsaPrivateKey }}" >> $GITHUB_ENV + echo "OPERATOR_ID=${{ steps.solo.outputs.ecdsaAccountId }}" >> $GITHUB_ENV echo "HEDERA_NETWORK=local-node" >> $GITHUB_ENV - name: Install dependencies diff --git a/examples/.env b/examples/.env index ebba785a91..845e42428e 100644 --- a/examples/.env +++ b/examples/.env @@ -1,6 +1,6 @@ # Local Node -OPERATOR_KEY=0xa608e2130a0a3cb34f86e757303c862bee353d9ab77ba4387ec084f881d420d4 -OPERATOR_ID=0.0.1022 +OPERATOR_KEY=0x105d050185ccb907fba04dd92d8de9e32c18305e097ab41dadda21489a211524 +OPERATOR_ID=0.0.1012 HEDERA_NETWORK=local-node NODE_COMMAND=node \ No newline at end of file diff --git a/examples/account-alias.js b/examples/account-alias.js index c98c63e598..bd6be5c580 100644 --- a/examples/account-alias.js +++ b/examples/account-alias.js @@ -58,7 +58,7 @@ async function main() { console.log('"Creating" a new account'); - const privateKey = PrivateKey.generateED25519(); + const privateKey = PrivateKey.generateECDSA(); const publicKey = privateKey.publicKey; // Assuming that the target shard and realm are known. diff --git a/examples/account-allowance.js b/examples/account-allowance.js index 0715a75e5f..2c2c565319 100644 --- a/examples/account-allowance.js +++ b/examples/account-allowance.js @@ -40,9 +40,9 @@ async function main() { console.log("Generating accounts for example..."); - const aliceKey = PrivateKey.generateED25519(); - const bobKey = PrivateKey.generateED25519(); - const charlieKey = PrivateKey.generateED25519(); + const aliceKey = PrivateKey.generateECDSA(); + const bobKey = PrivateKey.generateECDSA(); + const charlieKey = PrivateKey.generateECDSA(); try { let transaction = await new AccountCreateTransaction() diff --git a/examples/account-create-with-hts.js b/examples/account-create-with-hts.js index a378b6467d..f465bcc73e 100644 --- a/examples/account-create-with-hts.js +++ b/examples/account-create-with-hts.js @@ -47,14 +47,13 @@ async function main() { const supplyKey = PrivateKey.generateECDSA(); const freezeKey = PrivateKey.generateECDSA(); const wipeKey = PrivateKey.generateECDSA(); - if (process.env.OPERATOR_ID == null || process.env.OPERATOR_KEY == null) { throw new Error( "Environment variables OPERATOR_ID, and OPERATOR_KEY are required.", ); } const operatorId = AccountId.fromString(process.env.OPERATOR_ID); - const operatorKey = PrivateKey.fromStringDer(process.env.OPERATOR_KEY); + const operatorKey = PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY); const nodes = { "127.0.0.1:50211": new AccountId(3), diff --git a/examples/batch-tx.js b/examples/batch-tx.js index b8c5dc4ae7..a74ea48c66 100644 --- a/examples/batch-tx.js +++ b/examples/batch-tx.js @@ -32,7 +32,7 @@ async function main() { } const operatorAccId = AccountId.fromString(process.env.OPERATOR_ID); - const operatorPrivKey = PrivateKey.fromStringED25519( + const operatorPrivKey = PrivateKey.fromStringECDSA( process.env.OPERATOR_KEY, ); diff --git a/examples/change-or-remove-token-keys.js b/examples/change-or-remove-token-keys.js index a8b9d4f005..d00dde20c3 100644 --- a/examples/change-or-remove-token-keys.js +++ b/examples/change-or-remove-token-keys.js @@ -33,7 +33,7 @@ async function main() { // Configure client using environment variables const operatorId = AccountId.fromString(process.env.OPERATOR_ID); - const operatorKey = PrivateKey.fromStringED25519(process.env.OPERATOR_KEY); + const operatorKey = PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY); const client = Client.forName(network).setOperator(operatorId, operatorKey); @@ -41,14 +41,14 @@ async function main() { const infoLogger = new Logger(LogLevel.Info); client.setLogger(infoLogger); - const adminKey = PrivateKey.generateED25519(); - const supplyKey = PrivateKey.generateED25519(); - const newSupplyKey = PrivateKey.generateED25519(); - const wipeKey = PrivateKey.generateED25519(); - const freezeKey = PrivateKey.generateED25519(); - const pauseKey = PrivateKey.generateED25519(); - const feeScheduleKey = PrivateKey.generateED25519(); - const metadataKey = PrivateKey.generateED25519(); + const adminKey = PrivateKey.generateECDSA(); + const supplyKey = PrivateKey.generateECDSA(); + const newSupplyKey = PrivateKey.generateECDSA(); + const wipeKey = PrivateKey.generateECDSA(); + const freezeKey = PrivateKey.generateECDSA(); + const pauseKey = PrivateKey.generateECDSA(); + const feeScheduleKey = PrivateKey.generateECDSA(); + const metadataKey = PrivateKey.generateECDSA(); // This HIP introduces ability to remove lower-privilege keys (Wipe, KYC, Freeze, Pause, Supply, Fee Schedule, Metadata) from a Token: // - using an update with the empty KeyList; diff --git a/examples/consensus-pub-sub.js b/examples/consensus-pub-sub.js index ac0113b741..bac5abf4fe 100644 --- a/examples/consensus-pub-sub.js +++ b/examples/consensus-pub-sub.js @@ -27,7 +27,7 @@ async function main() { client = Client.forName(process.env.HEDERA_NETWORK).setOperator( AccountId.fromString(process.env.OPERATOR_ID), - PrivateKey.fromStringDer(process.env.OPERATOR_KEY), + PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY), ); try { diff --git a/examples/contract-nonces.js b/examples/contract-nonces.js index a7e7fa2947..e0bb0fc1cb 100644 --- a/examples/contract-nonces.js +++ b/examples/contract-nonces.js @@ -36,7 +36,7 @@ async function main() { try { const fileCreateTxResponse = await ( await new FileCreateTransaction() - .setKeys([PrivateKey.fromStringDer(process.env.OPERATOR_KEY)]) + .setKeys([PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY)]) .setContents(SMART_CONTRACT_BYTECODE) .setMaxTransactionFee(new Hbar(2)) .freezeWithSigner(wallet) @@ -48,7 +48,9 @@ async function main() { const contractCreateTxResponse = await ( await new ContractCreateTransaction() - .setAdminKey(PrivateKey.fromStringDer(process.env.OPERATOR_KEY)) + .setAdminKey( + PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY), + ) .setGas(100000) .setBytecodeFileId(newFileId) .setContractMemo( diff --git a/examples/create-account-with-alias-and-receiver-signature.js b/examples/create-account-with-alias-and-receiver-signature.js index 3cd507f744..93b1361e1f 100644 --- a/examples/create-account-with-alias-and-receiver-signature.js +++ b/examples/create-account-with-alias-and-receiver-signature.js @@ -15,7 +15,7 @@ dotenv.config(); /* Reference: [HIP-583 Expand alias support in CryptoCreate & CryptoTransfer Transactions](https://hips.hedera.com/hip/hip-583) ## Example 1: - - Create an ECSDA private key and an ED25519 admin private key + - Create an ECSDA private key and an ECDSA admin private key - Extract the ECDSA public key - Extract the Ethereum public address - Use the `AccountCreateTransaction` @@ -32,7 +32,7 @@ async function main() { ); } const operatorId = AccountId.fromString(process.env.OPERATOR_ID); - const operatorKey = PrivateKey.fromStringDer(process.env.OPERATOR_KEY); + const operatorKey = PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY); const nodes = { "127.0.0.1:50211": new AccountId(3), @@ -47,9 +47,9 @@ async function main() { /** * Step 1 * - * Create an ECSDA private key and an ED25519 admin private key + * Create an ECSDA private key and an ECDSA admin private key */ - const adminKey = PrivateKey.generateED25519(); + const adminKey = PrivateKey.generateECDSA(); console.log(`Admin private key: ${adminKey.toStringDer()}`); const privateKey = PrivateKey.generateECDSA(); diff --git a/examples/create-account-with-alias.js b/examples/create-account-with-alias.js index 248955b7e5..7b71708380 100644 --- a/examples/create-account-with-alias.js +++ b/examples/create-account-with-alias.js @@ -30,7 +30,7 @@ async function main() { ); } const operatorId = AccountId.fromString(process.env.OPERATOR_ID); - const operatorKey = PrivateKey.fromStringDer(process.env.OPERATOR_KEY); + const operatorKey = PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY); const nodes = { "127.0.0.1:50211": new AccountId(3), @@ -193,7 +193,7 @@ async function main() { * * Create an account key and an ECSDA private alias key */ - const key = PrivateKey.generateED25519(); + const key = PrivateKey.generateECDSA(); const aliasKey = PrivateKey.generateECDSA(); console.log(`Alias key: ${aliasKey.toStringDer()}`); @@ -341,7 +341,7 @@ async function main() { * * Create an account key and an derive an ECSDA public alias key */ - const key = PrivateKey.generateED25519(); + const key = PrivateKey.generateECDSA(); const aliasKey = PrivateKey.generateECDSA(); const publicAliasKey = aliasKey.publicKey; diff --git a/examples/create-account-with-thresholdkey.js b/examples/create-account-with-thresholdkey.js index 1f5655d110..4f7267f380 100644 --- a/examples/create-account-with-thresholdkey.js +++ b/examples/create-account-with-thresholdkey.js @@ -33,7 +33,7 @@ async function main() { } const operatorId = AccountId.fromString(process.env.OPERATOR_ID); - const operatorKey = PrivateKey.fromStringED25519(process.env.OPERATOR_KEY); + const operatorKey = PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY); // Create the client based on the HEDERA_NETWORK environment variable const client = Client.forName(process.env.HEDERA_NETWORK); @@ -56,7 +56,7 @@ async function main() { const privateKeys = []; const publicKeys = []; for (let i = 0; i < 3; i++) { - const key = PrivateKey.generateED25519(); + const key = PrivateKey.generateECDSA(); privateKeys.push(key); publicKeys.push(key.publicKey); } diff --git a/examples/create-topic-with-revenue.js b/examples/create-topic-with-revenue.js index 881125c8b8..58087bef68 100644 --- a/examples/create-topic-with-revenue.js +++ b/examples/create-topic-with-revenue.js @@ -31,7 +31,7 @@ async function main() { } const operatorId = AccountId.fromString(process.env.OPERATOR_ID); - const operatorKey = PrivateKey.fromStringDer(process.env.OPERATOR_KEY); + const operatorKey = PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY); const client = Client.forName(process.env.HEDERA_NETWORK).setOperator( operatorId, diff --git a/examples/create-update-delete-node.js b/examples/create-update-delete-node.js index 35fa83d1ee..b06dfd5a89 100644 --- a/examples/create-update-delete-node.js +++ b/examples/create-update-delete-node.js @@ -25,7 +25,7 @@ async function main() { const network = process.env.HEDERA_NETWORK; const operatorId = AccountId.fromString(process.env.OPERATOR_ID); - const operatorKey = PrivateKey.fromStringDer(process.env.OPERATOR_KEY); + const operatorKey = PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY); const client = Client.forName(network).setOperator(operatorId, operatorKey); // Transaction parameters diff --git a/examples/demo-umd/demo.html b/examples/demo-umd/demo.html index 9a23ebbf18..21d29fe832 100644 --- a/examples/demo-umd/demo.html +++ b/examples/demo-umd/demo.html @@ -37,7 +37,7 @@

Hiero UMD Builder

- You should use an ED25519 key for the operator. The network set + You should use an ECDSA key for the operator. The network set is TESTNET. diff --git a/examples/demo-umd/main.js b/examples/demo-umd/main.js index 330c363b48..3f3bb4ca3d 100644 --- a/examples/demo-umd/main.js +++ b/examples/demo-umd/main.js @@ -23,7 +23,7 @@ function executeTx() { // setup client and operator const operatorId = sdk.AccountId.fromString(operatorIdValue); - const operatorKey = sdk.PrivateKey.fromStringED25519(operatorKeyValue); + const operatorKey = sdk.PrivateKey.fromStringECDSA(operatorKeyValue); const client = sdk.Client.forTestnet().setOperator(operatorId, operatorKey); // start loading until the query is executed diff --git a/examples/ecrecover-example.js b/examples/ecrecover-example.js index 497d6cf004..245c3ad806 100644 --- a/examples/ecrecover-example.js +++ b/examples/ecrecover-example.js @@ -38,7 +38,7 @@ async function main() { } const operatorId = AccountId.fromString(process.env.OPERATOR_ID); - const operatorKey = PrivateKey.fromStringDer(process.env.OPERATOR_KEY); + const operatorKey = PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY); const client = Client.forLocalNode().setOperator(operatorId, operatorKey); console.log(`Operator account: ${operatorId.toString()}`); diff --git a/examples/ecrecover-mirror-node-example.js b/examples/ecrecover-mirror-node-example.js index ec56707a54..bd9e79b506 100644 --- a/examples/ecrecover-mirror-node-example.js +++ b/examples/ecrecover-mirror-node-example.js @@ -33,7 +33,7 @@ async function main() { } const operatorId = AccountId.fromString(process.env.OPERATOR_ID); - const operatorKey = PrivateKey.fromStringDer(process.env.OPERATOR_KEY); + const operatorKey = PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY); const client = Client.forLocalNode().setOperator(operatorId, operatorKey); console.log(`Operator account: ${operatorId.toString()}`); diff --git a/examples/error-handling-example.js b/examples/error-handling-example.js index 2009da2803..5af490cbdf 100644 --- a/examples/error-handling-example.js +++ b/examples/error-handling-example.js @@ -32,12 +32,12 @@ async function main() { } const operatorId = AccountId.fromString(process.env.OPERATOR_ID); - const operatorKey = PrivateKey.fromStringED25519(process.env.OPERATOR_KEY); + const operatorKey = PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY); const client = Client.forName(process.env.HEDERA_NETWORK); client.setOperator(operatorId, operatorKey); - const newKey = PrivateKey.generateED25519(); + const newKey = PrivateKey.generateECDSA(); console.log(`Generated new public key: ${newKey.publicKey.toString()}`); let accountId = null; diff --git a/examples/error-handling-single-node-execution.js b/examples/error-handling-single-node-execution.js index 958154ddfd..a8c37b933f 100644 --- a/examples/error-handling-single-node-execution.js +++ b/examples/error-handling-single-node-execution.js @@ -33,7 +33,7 @@ async function main() { } const operatorId = AccountId.fromString(process.env.OPERATOR_ID); - const operatorKey = PrivateKey.fromStringED25519(process.env.OPERATOR_KEY); + const operatorKey = PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY); const client = Client.forName(process.env.HEDERA_NETWORK); client.setOperator(operatorId, operatorKey); diff --git a/examples/exempt-custom-fees.js b/examples/exempt-custom-fees.js index d4a6f1bd7d..116d16140a 100644 --- a/examples/exempt-custom-fees.js +++ b/examples/exempt-custom-fees.js @@ -44,7 +44,7 @@ async function main() { } // Configure accounts and client, and generate needed keys const operatorId = AccountId.fromString(process.env.OPERATOR_ID); - const operatorKey = PrivateKey.fromStringDer(process.env.OPERATOR_KEY); + const operatorKey = PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY); const provider = new LocalProvider(); @@ -58,7 +58,7 @@ async function main() { * Create accounts A, B, and C */ - let firstAccountPrivateKey = PrivateKey.generateED25519(); + let firstAccountPrivateKey = PrivateKey.generateECDSA(); let firstAccountPublicKey = firstAccountPrivateKey.publicKey; let createAccountAtx = await new AccountCreateTransaction() @@ -77,7 +77,7 @@ async function main() { provider, ); - let secondAccountPrivateKey = PrivateKey.generateED25519(); + let secondAccountPrivateKey = PrivateKey.generateECDSA(); let secondAccountPublicKey = secondAccountPrivateKey.publicKey; let createAccountBtx = await new AccountCreateTransaction() @@ -96,7 +96,7 @@ async function main() { provider, ); - let thirdAccountPrivateKey = PrivateKey.generateED25519(); + let thirdAccountPrivateKey = PrivateKey.generateECDSA(); let thirdAccountPublicKey = thirdAccountPrivateKey.publicKey; let createAccountCtx = await new AccountCreateTransaction() diff --git a/examples/frontend-examples/src/app/client/async-client/page.js b/examples/frontend-examples/src/app/client/async-client/page.js index 9ac3410104..0ef9b79f78 100644 --- a/examples/frontend-examples/src/app/client/async-client/page.js +++ b/examples/frontend-examples/src/app/client/async-client/page.js @@ -56,7 +56,9 @@ const ClientProvider = ({ children }) => { // Set operator for the client newClient.setOperator( AccountId.fromString(process.env.NEXT_PUBLIC_OPERATOR_ID), - PrivateKey.fromStringDer(process.env.NEXT_PUBLIC_OPERATOR_KEY), + PrivateKey.fromStringECDSA( + process.env.NEXT_PUBLIC_OPERATOR_KEY, + ), ); setClient(newClient); @@ -176,7 +178,7 @@ const AsyncClientDemo = () => { setIsActionLoading(true); try { - const privateKey = PrivateKey.generateED25519(); + const privateKey = PrivateKey.generateECDSA(); const publicKey = privateKey.publicKey; const transaction = await new AccountCreateTransaction() diff --git a/examples/frontend-examples/src/app/client/grpc-web-proxy/page.js b/examples/frontend-examples/src/app/client/grpc-web-proxy/page.js index a3428d7587..c1527ef6af 100644 --- a/examples/frontend-examples/src/app/client/grpc-web-proxy/page.js +++ b/examples/frontend-examples/src/app/client/grpc-web-proxy/page.js @@ -41,7 +41,7 @@ const Home = () => { const client = useMemo(() => { return WebClient.forNetwork(initialNetwork).setOperator( AccountId.fromString(process.env.NEXT_PUBLIC_OPERATOR_ID), - PrivateKey.fromStringDer(process.env.NEXT_PUBLIC_OPERATOR_KEY), + PrivateKey.fromStringECDSA(process.env.NEXT_PUBLIC_OPERATOR_KEY), ); }, []); @@ -80,7 +80,7 @@ const Home = () => { setIsLoading(true); try { console.log(client.network); - const privateKey = PrivateKey.generateED25519(); + const privateKey = PrivateKey.generateECDSA(); const publicKey = privateKey.publicKey; const transaction = await new AccountCreateTransaction() diff --git a/examples/frontend-examples/src/app/components/TopicListener.js b/examples/frontend-examples/src/app/components/TopicListener.js index 119cb8ef36..13fa716ad4 100644 --- a/examples/frontend-examples/src/app/components/TopicListener.js +++ b/examples/frontend-examples/src/app/components/TopicListener.js @@ -1,5 +1,5 @@ import EventEmitter from "events"; -import { useEffect, useState } from "react"; +import { useEffect, useState, useRef } from "react"; const TopicListener = ({ topicId }) => { const [messages, setMessages] = useState([]); diff --git a/examples/frontend-examples/src/app/topic/message-query/page.js b/examples/frontend-examples/src/app/topic/message-query/page.js index cbd32fc4cc..84e700e61b 100644 --- a/examples/frontend-examples/src/app/topic/message-query/page.js +++ b/examples/frontend-examples/src/app/topic/message-query/page.js @@ -22,7 +22,7 @@ const MessageQueryPage = () => { // Setup Hedera client const accountId = AccountId.fromString(process.env.NEXT_PUBLIC_OPERATOR_ID); - const operatorKey = PrivateKey.fromStringED25519( + const operatorKey = PrivateKey.fromStringECDSA( process.env.NEXT_PUBLIC_OPERATOR_KEY, ); const client = Client.forTestnet().setOperator(accountId, operatorKey); diff --git a/examples/frontend-examples/src/app/transaction/jumbo/page.js b/examples/frontend-examples/src/app/transaction/jumbo/page.js index 95bd75ab7e..fea0443405 100644 --- a/examples/frontend-examples/src/app/transaction/jumbo/page.js +++ b/examples/frontend-examples/src/app/transaction/jumbo/page.js @@ -32,7 +32,7 @@ const JumboPage = () => { const operatorId = AccountId.fromString( process.env.NEXT_PUBLIC_OPERATOR_ID, ); - const operatorKey = PrivateKey.fromStringED25519( + const operatorKey = PrivateKey.fromStringECDSA( process.env.NEXT_PUBLIC_OPERATOR_KEY, ); const [contractId, setContractId] = useState("0.0.6255191"); diff --git a/examples/frontend-examples/src/app/transaction/size/page.js b/examples/frontend-examples/src/app/transaction/size/page.js index 3dd88a09c1..b7dc324143 100644 --- a/examples/frontend-examples/src/app/transaction/size/page.js +++ b/examples/frontend-examples/src/app/transaction/size/page.js @@ -18,7 +18,7 @@ const Home = () => { const client = WebClient.forTestnet().setOperator( AccountId.fromString(process.env.NEXT_PUBLIC_OPERATOR_ID), - PrivateKey.fromStringDer(process.env.NEXT_PUBLIC_OPERATOR_KEY), + PrivateKey.fromStringECDSA(process.env.NEXT_PUBLIC_OPERATOR_KEY), ); return ( @@ -48,7 +48,7 @@ const Home = () => { const tx = new AccountCreateTransaction(); if (key) { tx.setKeyWithoutAlias( - PublicKey.fromStringED25519(key), + PublicKey.fromStringECDSA(key), ); } if (initialBalance) { diff --git a/examples/generate-key.js b/examples/generate-key.js index 6bebd89802..60aa9e0fc5 100644 --- a/examples/generate-key.js +++ b/examples/generate-key.js @@ -6,7 +6,7 @@ async function main() { const mnemonic = await Mnemonic.generate(); console.log(`24 words mnemonic = ${mnemonic.toString()}`); - const key = await mnemonic.toStandardEd25519PrivateKey("", 0); + const key = await mnemonic.toStandardECDSAsecp256k1PrivateKey("", 0); console.log(`private key = ${key.toString()}`); console.log(`public key = ${key.publicKey.toString()}`); @@ -18,7 +18,7 @@ async function main() { mnemonic.toString(), ); const recoveredRootKey = - await recoveredMnemonic.toStandardEd25519PrivateKey("", 0); + await recoveredMnemonic.toStandardECDSAsecp256k1PrivateKey("", 0); recoveredRootKey.toString() === key.toString() ? console.log(`successful key recovery!`) @@ -27,7 +27,10 @@ async function main() { const mnemonic12 = await Mnemonic.generate12(); console.log(`12 words mnemonic = ${mnemonic12.toString()}`); - const key12 = await mnemonic12.toStandardEd25519PrivateKey("", 0); + const key12 = await mnemonic12.toStandardECDSAsecp256k1PrivateKey( + "", + 0, + ); console.log(`private key = ${key12.toString()}`); console.log(`public key = ${key12.publicKey.toString()}`); } catch (error) { diff --git a/examples/generate-txid-on-demand.js b/examples/generate-txid-on-demand.js index a2fba85f54..f8d34ef4d4 100644 --- a/examples/generate-txid-on-demand.js +++ b/examples/generate-txid-on-demand.js @@ -49,7 +49,7 @@ async function main() { ); } const operatorId = AccountId.fromString(process.env.OPERATOR_ID); - const operatorKey = PrivateKey.fromStringDer(process.env.OPERATOR_KEY); + const operatorKey = PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY); let client; diff --git a/examples/get-exchangerates.js b/examples/get-exchangerates.js index 607ddc1d17..eabbff42fc 100644 --- a/examples/get-exchangerates.js +++ b/examples/get-exchangerates.js @@ -3,6 +3,7 @@ import { LocalProvider, FileContentsQuery, ExchangeRates, + PrivateKey, } from "@hashgraph/sdk"; import dotenv from "dotenv"; @@ -22,11 +23,10 @@ async function main() { const provider = new LocalProvider(); - const wallet = new Wallet( - process.env.OPERATOR_ID, - process.env.OPERATOR_KEY, - provider, - ); + // Parse ECDSA key explicitly + const operatorKey = PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY); + + const wallet = new Wallet(process.env.OPERATOR_ID, operatorKey, provider); let resp; try { resp = await new FileContentsQuery() diff --git a/examples/get-file-contents.js b/examples/get-file-contents.js index 7e175ef080..9fb9dd7f06 100644 --- a/examples/get-file-contents.js +++ b/examples/get-file-contents.js @@ -34,7 +34,7 @@ async function main() { } const operatorId = AccountId.fromString(process.env.OPERATOR_ID); - const operatorKey = PrivateKey.fromStringED25519(process.env.OPERATOR_KEY); + const operatorKey = PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY); // Create the client based on the HEDERA_NETWORK environment variable const client = Client.forName(process.env.HEDERA_NETWORK); diff --git a/examples/hts-nftP1-fee-create-mint-burn-associate-transfer.js b/examples/hts-nftP1-fee-create-mint-burn-associate-transfer.js index db051033e6..11a094843e 100644 --- a/examples/hts-nftP1-fee-create-mint-burn-associate-transfer.js +++ b/examples/hts-nftP1-fee-create-mint-burn-associate-transfer.js @@ -29,7 +29,7 @@ dotenv.config(); // Configure accounts and client, and generate needed keys const operatorId = AccountId.fromString(process.env.OPERATOR_ID); -const operatorKey = PrivateKey.fromStringDer(process.env.OPERATOR_KEY); +const operatorKey = PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY); const nodes = { "127.0.0.1:50211": new AccountId(3), }; diff --git a/examples/hts-nftP2-kyc-upate-schedule.js b/examples/hts-nftP2-kyc-upate-schedule.js index 85391e2d8b..3668d6ee96 100644 --- a/examples/hts-nftP2-kyc-upate-schedule.js +++ b/examples/hts-nftP2-kyc-upate-schedule.js @@ -33,7 +33,7 @@ dotenv.config(); // Configure accounts and client, and generate needed keys const operatorId = AccountId.fromString(process.env.OPERATOR_ID); -const operatorKey = PrivateKey.fromStringDer(process.env.OPERATOR_KEY); +const operatorKey = PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY); const nodes = { "127.0.0.1:50211": new AccountId(3), }; diff --git a/examples/hts-nftP3-pause-freeze-wipe-delete.js b/examples/hts-nftP3-pause-freeze-wipe-delete.js index d71e5aeff1..0c458e4b06 100644 --- a/examples/hts-nftP3-pause-freeze-wipe-delete.js +++ b/examples/hts-nftP3-pause-freeze-wipe-delete.js @@ -39,7 +39,7 @@ dotenv.config(); // Configure accounts and client, and generate needed keys const operatorId = AccountId.fromString(process.env.OPERATOR_ID); -const operatorKey = PrivateKey.fromStringDer(process.env.OPERATOR_KEY); +const operatorKey = PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY); const nodes = { "127.0.0.1:50211": new AccountId(3), }; diff --git a/examples/initialize-client-with-mirror-node-adress-book.js b/examples/initialize-client-with-mirror-node-adress-book.js index d7f67b324b..5119300d28 100644 --- a/examples/initialize-client-with-mirror-node-adress-book.js +++ b/examples/initialize-client-with-mirror-node-adress-book.js @@ -26,7 +26,7 @@ async function main() { } const operatorId = AccountId.fromString(process.env.OPERATOR_ID); - const operatorKey = PrivateKey.fromStringED25519(process.env.OPERATOR_KEY); + const operatorKey = PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY); const accountKey = PrivateKey.generate(); diff --git a/examples/lazy-create-transfer-tx.js b/examples/lazy-create-transfer-tx.js index 68589bcfb1..b4fb8cd93f 100644 --- a/examples/lazy-create-transfer-tx.js +++ b/examples/lazy-create-transfer-tx.js @@ -49,7 +49,7 @@ async function main() { ); } const operatorId = AccountId.fromString(process.env.OPERATOR_ID); - const operatorKey = PrivateKey.fromStringDer(process.env.OPERATOR_KEY); + const operatorKey = PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY); const nodes = { "127.0.0.1:50211": new AccountId(3), diff --git a/examples/legacy-way-sign-transaction.js b/examples/legacy-way-sign-transaction.js index f38ec80946..304ca17181 100644 --- a/examples/legacy-way-sign-transaction.js +++ b/examples/legacy-way-sign-transaction.js @@ -10,7 +10,7 @@ import dotenv from "dotenv"; dotenv.config(); const OPERATOR_ID = AccountId.fromString(process.env.OPERATOR_ID); -const OPERATOR_KEY = PrivateKey.fromStringED25519(process.env.OPERATOR_KEY); +const OPERATOR_KEY = PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY); const HEDERA_NETWORK = process.env.HEDERA_NETWORK; async function main() { @@ -19,7 +19,7 @@ async function main() { client.setOperator(OPERATOR_ID, OPERATOR_KEY); // Step 1: Generate private key for a future account create transaction - const key = PrivateKey.generateED25519(); + const key = PrivateKey.generateECDSA(); // Step 2: Create transaction without signing it const tx = new AccountCreateTransaction() diff --git a/examples/logger-functionalities.js b/examples/logger-functionalities.js index ea9109d010..e0cc0174c8 100644 --- a/examples/logger-functionalities.js +++ b/examples/logger-functionalities.js @@ -42,7 +42,7 @@ async function main() { } const operatorId = AccountId.fromString(process.env.OPERATOR_ID); - const operatorKey = PrivateKey.fromStringDer(process.env.OPERATOR_KEY); + const operatorKey = PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY); let debugLogger = new Logger(LogLevel.Debug); let infoLogger = new Logger(LogLevel.Info); @@ -60,7 +60,7 @@ async function main() { const wallet = new Wallet(client.operatorAccountId, operatorKey, provider); - const privateKey = PrivateKey.generateED25519(); + const privateKey = PrivateKey.generateECDSA(); const publicKey = privateKey.publicKey; const aliasAccountId = publicKey.toAccountId(0, 0); diff --git a/examples/long-term-schedule-transaction.js b/examples/long-term-schedule-transaction.js index 1305f43ea2..d9c1ae1db9 100644 --- a/examples/long-term-schedule-transaction.js +++ b/examples/long-term-schedule-transaction.js @@ -30,13 +30,13 @@ async function main() { // Step 0: Create and configure the SDK Client. const operatorId = process.env.OPERATOR_ID; - const operatorKey = PrivateKey.fromStringED25519(process.env.OPERATOR_KEY); + const operatorKey = PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY); const client = Client.forName(process.env.HEDERA_NETWORK || "testnet"); client.setOperator(operatorId, operatorKey); // Step 1: Create key pairs - const privateKey1 = PrivateKey.generateED25519(); - const privateKey2 = PrivateKey.generateED25519(); + const privateKey1 = PrivateKey.generateECDSA(); + const privateKey2 = PrivateKey.generateECDSA(); const thresholdKey = new KeyList([ privateKey1.publicKey, privateKey2.publicKey, diff --git a/examples/mint-big-number-of-units-of-token.js b/examples/mint-big-number-of-units-of-token.js index bf244fec65..40c0caf843 100644 --- a/examples/mint-big-number-of-units-of-token.js +++ b/examples/mint-big-number-of-units-of-token.js @@ -14,7 +14,7 @@ import dotenv from "dotenv"; dotenv.config(); async function main() { - const operatorKey = PrivateKey.fromStringED25519(process.env.OPERATOR_KEY); + const operatorKey = PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY); const operatorId = AccountId.fromString(process.env.OPERATOR_ID); const client = Client.forName(process.env.HEDERA_NETWORK).setOperator( diff --git a/examples/mirror-node-contract-queries-example.js b/examples/mirror-node-contract-queries-example.js index 5595be2c97..be367b5940 100644 --- a/examples/mirror-node-contract-queries-example.js +++ b/examples/mirror-node-contract-queries-example.js @@ -18,7 +18,7 @@ import dotenv from "dotenv"; dotenv.config(); const OPERATOR_ID = AccountId.fromString(process.env.OPERATOR_ID); -const OPERATOR_KEY = PrivateKey.fromStringED25519(process.env.OPERATOR_KEY); +const OPERATOR_KEY = PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY); const HEDERA_NETWORK = process.env.HEDERA_NETWORK || "testnet"; async function main() { diff --git a/examples/multi-node-multi-signature-remove.js b/examples/multi-node-multi-signature-remove.js index b2a5c1e60a..44cc2b966e 100644 --- a/examples/multi-node-multi-signature-remove.js +++ b/examples/multi-node-multi-signature-remove.js @@ -40,7 +40,7 @@ async function main() { const client = Client.forName(process.env.HEDERA_NETWORK).setOperator( AccountId.fromString(process.env.OPERATOR_ID), - PrivateKey.fromStringED25519(process.env.OPERATOR_KEY), + PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY), ); /** @@ -179,7 +179,7 @@ const getAllSignaturesFromTransaction = (signedTransaction) => { transaction.sigMap.sigPair.forEach((sigPair) => { if (sigPair.ed25519) { signatures.push( - PrivateKey.fromBytesED25519( + PrivateKey.fromBytesECDSA( sigPair.ed25519, ).toStringDer(), ); diff --git a/examples/multi-node-multi-signature-removeAll.js b/examples/multi-node-multi-signature-removeAll.js index b546d9179d..8d111f5257 100644 --- a/examples/multi-node-multi-signature-removeAll.js +++ b/examples/multi-node-multi-signature-removeAll.js @@ -40,7 +40,7 @@ async function main() { const client = Client.forName(process.env.HEDERA_NETWORK).setOperator( AccountId.fromString(process.env.OPERATOR_ID), - PrivateKey.fromStringED25519(process.env.OPERATOR_KEY), + PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY), ); /** @@ -177,7 +177,7 @@ const getAllSignaturesFromTransaction = (signedTransaction) => { transaction.sigMap.sigPair.forEach((sigPair) => { if (sigPair.ed25519) { signatures.push( - PrivateKey.fromBytesED25519( + PrivateKey.fromBytesECDSA( sigPair.ed25519, ).toStringDer(), ); diff --git a/examples/multi-node-multi-signature.js b/examples/multi-node-multi-signature.js index 6a6686058f..0738652f83 100644 --- a/examples/multi-node-multi-signature.js +++ b/examples/multi-node-multi-signature.js @@ -35,7 +35,7 @@ async function main() { const client = Client.forName(process.env.HEDERA_NETWORK).setOperator( AccountId.fromString(process.env.OPERATOR_ID), - PrivateKey.fromStringED25519(process.env.OPERATOR_KEY), + PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY), ); /** @@ -161,7 +161,7 @@ const getAllSignaturesFromTransaction = (signedTransaction) => { transaction.sigMap.sigPair.forEach((sigPair) => { if (sigPair.ed25519) { signatures.push( - PrivateKey.fromBytesED25519( + PrivateKey.fromBytesECDSA( sigPair.ed25519, ).toStringDer(), ); diff --git a/examples/multi-sig-offline.js b/examples/multi-sig-offline.js index fa33b603cc..bf8fd8e3f6 100644 --- a/examples/multi-sig-offline.js +++ b/examples/multi-sig-offline.js @@ -32,7 +32,7 @@ async function main() { const client = Client.forName(process.env.HEDERA_NETWORK).setOperator( AccountId.fromString(process.env.OPERATOR_ID), - PrivateKey.fromStringDer(process.env.OPERATOR_KEY), + PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY), ); user1Key = PrivateKey.generate(); diff --git a/examples/nft-add-remove-allowances.js b/examples/nft-add-remove-allowances.js index 9448a50e9f..ed80f7d6ab 100644 --- a/examples/nft-add-remove-allowances.js +++ b/examples/nft-add-remove-allowances.js @@ -42,7 +42,7 @@ async function main() { ); } const operatorId = AccountId.fromString(process.env.OPERATOR_ID); - const operatorKey = PrivateKey.fromStringDer(process.env.OPERATOR_KEY); + const operatorKey = PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY); const nodes = { "127.0.0.1:50211": new AccountId(3), }; diff --git a/examples/node-client-async-testnet.js b/examples/node-client-async-testnet.js index 7f6487aaa3..a03b7295e0 100644 --- a/examples/node-client-async-testnet.js +++ b/examples/node-client-async-testnet.js @@ -39,7 +39,7 @@ async function main() { // Set the operator for the client const operatorId = AccountId.fromString(process.env.OPERATOR_ID); - const operatorKey = PrivateKey.fromStringED25519( + const operatorKey = PrivateKey.fromStringECDSA( process.env.OPERATOR_KEY, ); client.setOperator(operatorId, operatorKey); @@ -79,7 +79,7 @@ async function main() { // Create a new account console.log("Creating a new account..."); try { - const newKey = PrivateKey.generateED25519(); + const newKey = PrivateKey.generateECDSA(); console.log(`Generated new key pair:`); console.log(` Private Key: ${newKey.toString()}`); console.log(` Public Key: ${newKey.publicKey.toString()}`); diff --git a/examples/react-native-example/App.tsx b/examples/react-native-example/App.tsx index 83bc0fdce3..7f82b53c17 100644 --- a/examples/react-native-example/App.tsx +++ b/examples/react-native-example/App.tsx @@ -29,7 +29,7 @@ const styles = StyleSheet.create({ const App = () => { const operatorId = AccountId.fromString(OPERATOR_ID); - const operatorKey = PrivateKey.fromString(OPERATOR_KEY); + const operatorKey = PrivateKey.fromStringECDSA(OPERATOR_KEY); const client = Client.forTestnet().setOperator(operatorId, operatorKey); const [transaction, setTransaction] = useState( diff --git a/examples/serialize-deserialize-1.js b/examples/serialize-deserialize-1.js index 449646a6e7..d4e5e81750 100644 --- a/examples/serialize-deserialize-1.js +++ b/examples/serialize-deserialize-1.js @@ -30,7 +30,7 @@ async function main() { // Configure client using environment variables const operatorId = AccountId.fromString(process.env.OPERATOR_ID); - const operatorKey = PrivateKey.fromStringED25519(process.env.OPERATOR_KEY); + const operatorKey = PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY); const client = Client.forName(network).setOperator(operatorId, operatorKey); diff --git a/examples/serialize-deserialize-10.js b/examples/serialize-deserialize-10.js index 4f7dee94e7..3d07c88ae5 100644 --- a/examples/serialize-deserialize-10.js +++ b/examples/serialize-deserialize-10.js @@ -29,7 +29,7 @@ async function main() { // Configure client using environment variables const operatorId = AccountId.fromString(process.env.OPERATOR_ID); - const operatorKey = PrivateKey.fromStringED25519(process.env.OPERATOR_KEY); + const operatorKey = PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY); const provider = new LocalProvider(); const infoLogger = new Logger(LogLevel.Info); diff --git a/examples/serialize-deserialize-11.js b/examples/serialize-deserialize-11.js index 3ce285e3d5..0694bb2d8c 100644 --- a/examples/serialize-deserialize-11.js +++ b/examples/serialize-deserialize-11.js @@ -27,7 +27,7 @@ async function main() { // Configure client using environment variables const operatorId = AccountId.fromString(process.env.OPERATOR_ID); - const operatorKey = PrivateKey.fromStringED25519(process.env.OPERATOR_KEY); + const operatorKey = PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY); const provider = new LocalProvider(); const infoLogger = new Logger(LogLevel.Info); diff --git a/examples/serialize-deserialize-12.js b/examples/serialize-deserialize-12.js index 58580a6594..4ffcbecec1 100644 --- a/examples/serialize-deserialize-12.js +++ b/examples/serialize-deserialize-12.js @@ -30,7 +30,7 @@ async function main() { // Configure client using environment variables const operatorId = AccountId.fromString(process.env.OPERATOR_ID); - const operatorKey = PrivateKey.fromStringED25519(process.env.OPERATOR_KEY); + const operatorKey = PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY); const client = Client.forName(network).setOperator(operatorId, operatorKey); diff --git a/examples/serialize-deserialize-2.js b/examples/serialize-deserialize-2.js index 2508f77019..351db5a626 100644 --- a/examples/serialize-deserialize-2.js +++ b/examples/serialize-deserialize-2.js @@ -30,7 +30,7 @@ async function main() { // Configure client using environment variables const operatorId = AccountId.fromString(process.env.OPERATOR_ID); - const operatorKey = PrivateKey.fromStringED25519(process.env.OPERATOR_KEY); + const operatorKey = PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY); const client = Client.forName(network).setOperator(operatorId, operatorKey); diff --git a/examples/serialize-deserialize-3.js b/examples/serialize-deserialize-3.js index 2fbba6fddb..5f272ca518 100644 --- a/examples/serialize-deserialize-3.js +++ b/examples/serialize-deserialize-3.js @@ -30,7 +30,7 @@ async function main() { // Configure client using environment variables const operatorId = AccountId.fromString(process.env.OPERATOR_ID); - const operatorKey = PrivateKey.fromStringED25519(process.env.OPERATOR_KEY); + const operatorKey = PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY); const client = Client.forName(network).setOperator(operatorId, operatorKey); diff --git a/examples/serialize-deserialize-4.js b/examples/serialize-deserialize-4.js index 782482f588..3e5629a72e 100644 --- a/examples/serialize-deserialize-4.js +++ b/examples/serialize-deserialize-4.js @@ -30,7 +30,7 @@ async function main() { // Configure client using environment variables const operatorId = AccountId.fromString(process.env.OPERATOR_ID); - const operatorKey = PrivateKey.fromStringED25519(process.env.OPERATOR_KEY); + const operatorKey = PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY); const client = Client.forName(network).setOperator(operatorId, operatorKey); diff --git a/examples/serialize-deserialize-5.js b/examples/serialize-deserialize-5.js index 8f37397d6b..c2b6cf383f 100644 --- a/examples/serialize-deserialize-5.js +++ b/examples/serialize-deserialize-5.js @@ -32,7 +32,7 @@ async function main() { // Configure client using environment variables const operatorId = AccountId.fromString(process.env.OPERATOR_ID); - const operatorKey = PrivateKey.fromStringED25519(process.env.OPERATOR_KEY); + const operatorKey = PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY); const client = Client.forName(network).setOperator(operatorId, operatorKey); diff --git a/examples/serialize-deserialize-6.js b/examples/serialize-deserialize-6.js index 291b955446..2a1a5d5af1 100644 --- a/examples/serialize-deserialize-6.js +++ b/examples/serialize-deserialize-6.js @@ -30,7 +30,7 @@ async function main() { // Configure client using environment variables const operatorId = AccountId.fromString(process.env.OPERATOR_ID); - const operatorKey = PrivateKey.fromStringED25519(process.env.OPERATOR_KEY); + const operatorKey = PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY); const client = Client.forName(network).setOperator(operatorId, operatorKey); diff --git a/examples/serialize-deserialize-7.js b/examples/serialize-deserialize-7.js index 8de89f3f8c..8684216b62 100644 --- a/examples/serialize-deserialize-7.js +++ b/examples/serialize-deserialize-7.js @@ -27,7 +27,7 @@ async function main() { // Configure client using environment variables const operatorId = AccountId.fromString(process.env.OPERATOR_ID); - const operatorKey = PrivateKey.fromStringED25519(process.env.OPERATOR_KEY); + const operatorKey = PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY); const provider = new LocalProvider(); const infoLogger = new Logger(LogLevel.Info); diff --git a/examples/serialize-deserialize-8.js b/examples/serialize-deserialize-8.js index cd4ccf0bbd..3da09d3924 100644 --- a/examples/serialize-deserialize-8.js +++ b/examples/serialize-deserialize-8.js @@ -27,7 +27,7 @@ async function main() { // Configure client using environment variables const operatorId = AccountId.fromString(process.env.OPERATOR_ID); - const operatorKey = PrivateKey.fromStringED25519(process.env.OPERATOR_KEY); + const operatorKey = PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY); const provider = new LocalProvider(); const infoLogger = new Logger(LogLevel.Info); diff --git a/examples/serialize-deserialize-9.js b/examples/serialize-deserialize-9.js index 079b425ae2..384f2a40cb 100644 --- a/examples/serialize-deserialize-9.js +++ b/examples/serialize-deserialize-9.js @@ -27,7 +27,7 @@ async function main() { // Configure client using environment variables const operatorId = AccountId.fromString(process.env.OPERATOR_ID); - const operatorKey = PrivateKey.fromStringED25519(process.env.OPERATOR_KEY); + const operatorKey = PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY); const provider = new LocalProvider(); const infoLogger = new Logger(LogLevel.Info); diff --git a/examples/solidity-precompile-example.js b/examples/solidity-precompile-example.js index e43d27f94c..6664d7dfbd 100644 --- a/examples/solidity-precompile-example.js +++ b/examples/solidity-precompile-example.js @@ -24,7 +24,7 @@ async function main() { provider, ); - const operatorPrivateKey = hashgraph.PrivateKey.fromStringED25519( + const operatorPrivateKey = hashgraph.PrivateKey.fromStringECDSA( process.env.OPERATOR_KEY, ); const operatorPublicKey = operatorPrivateKey.publicKey; @@ -33,7 +33,7 @@ async function main() { process.env.OPERATOR_ID, ); - const alicePrivateKey = hashgraph.PrivateKey.generateED25519(); + const alicePrivateKey = hashgraph.PrivateKey.generateECDSA(); const alicePublicKey = alicePrivateKey.publicKey; try { diff --git a/examples/time-drift.js b/examples/time-drift.js index 88b3b4b79d..98ce373416 100644 --- a/examples/time-drift.js +++ b/examples/time-drift.js @@ -54,7 +54,7 @@ async function main() { const client = Client.forName(process.env.HEDERA_NETWORK).setOperator( AccountId.fromString(process.env.OPERATOR_ID), - PrivateKey.fromStringDer(process.env.OPERATOR_KEY), + PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY), ); await sync(); diff --git a/examples/token-airdrop-example.js b/examples/token-airdrop-example.js index 95a5334581..918fa1ee72 100644 --- a/examples/token-airdrop-example.js +++ b/examples/token-airdrop-example.js @@ -32,7 +32,7 @@ async function main() { const client = Client.forName(process.env.HEDERA_NETWORK).setOperator( AccountId.fromString(process.env.OPERATOR_ID), - PrivateKey.fromStringDer(process.env.OPERATOR_KEY), + PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY), ); const CID = [ @@ -66,7 +66,7 @@ async function main() { .execute(client) ).getReceipt(client); - const privateKey3 = PrivateKey.generateED25519(); + const privateKey3 = PrivateKey.generateECDSA(); const { accountId: accountId3 } = await ( await new AccountCreateTransaction() .setKeyWithoutAlias(privateKey3) diff --git a/examples/token-reject.js b/examples/token-reject.js index 0de4e2232f..e062eea9c0 100644 --- a/examples/token-reject.js +++ b/examples/token-reject.js @@ -33,12 +33,12 @@ async function main() { "QmPzY5GxevjyfMUF5vEAjtyRoigzWp47MiKAtLBduLMC1T", ]; const operatorId = AccountId.fromString(process.env.OPERATOR_ID); - const operatorKey = PrivateKey.fromStringED25519(process.env.OPERATOR_KEY); + const operatorKey = PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY); const network = process.env.HEDERA_NETWORK; const client = Client.forName(network).setOperator(operatorId, operatorKey); // create a treasury account - const treasuryPrivateKey = PrivateKey.generateED25519(); + const treasuryPrivateKey = PrivateKey.generateECDSA(); const treasuryAccountId = ( await ( await new AccountCreateTransaction() @@ -49,7 +49,7 @@ async function main() { ).accountId; // create a receiver account with unlimited max auto associations - const receiverPrivateKey = PrivateKey.generateED25519(); + const receiverPrivateKey = PrivateKey.generateECDSA(); const receiverAccountId = ( await ( await new AccountCreateTransaction() diff --git a/examples/topic-message-submit-get-all-chunks-status.js b/examples/topic-message-submit-get-all-chunks-status.js index 0d979e28fd..56bae88b78 100644 --- a/examples/topic-message-submit-get-all-chunks-status.js +++ b/examples/topic-message-submit-get-all-chunks-status.js @@ -32,7 +32,7 @@ async function main() { const client = Client.forName(process.env.HEDERA_NETWORK).setOperator( AccountId.fromString(process.env.OPERATOR_ID), - PrivateKey.fromStringDer(process.env.OPERATOR_KEY), + PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY), ); try { diff --git a/examples/transfer-using-evm-address.js b/examples/transfer-using-evm-address.js index f27f5f8989..33069377b1 100644 --- a/examples/transfer-using-evm-address.js +++ b/examples/transfer-using-evm-address.js @@ -41,7 +41,7 @@ async function main() { ); } const operatorId = AccountId.fromString(process.env.OPERATOR_ID); - const operatorKey = PrivateKey.fromStringDer(process.env.OPERATOR_KEY); + const operatorKey = PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY); const nodes = { "127.0.0.1:50211": new AccountId(3), diff --git a/examples/update-fungible-token-metadata-with-admin-key.js b/examples/update-fungible-token-metadata-with-admin-key.js index c9031ea435..d1fb8a2941 100644 --- a/examples/update-fungible-token-metadata-with-admin-key.js +++ b/examples/update-fungible-token-metadata-with-admin-key.js @@ -25,12 +25,12 @@ async function main() { } const operatorId = AccountId.fromString(process.env.OPERATOR_ID); - const operatorKey = PrivateKey.fromStringDer(process.env.OPERATOR_KEY); + const operatorKey = PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY); const network = process.env.HEDERA_NETWORK; const client = Client.forName(network).setOperator(operatorId, operatorKey); // Generate a admin key - const adminKey = PrivateKey.generateED25519(); + const adminKey = PrivateKey.generateECDSA(); // Initial metadata const metadata = new Uint8Array([1]); // New metadata diff --git a/examples/update-fungible-token-metadata-with-metadata-key.js b/examples/update-fungible-token-metadata-with-metadata-key.js index 99227d7d68..ced25b41ab 100644 --- a/examples/update-fungible-token-metadata-with-metadata-key.js +++ b/examples/update-fungible-token-metadata-with-metadata-key.js @@ -25,12 +25,12 @@ async function main() { } const operatorId = AccountId.fromString(process.env.OPERATOR_ID); - const operatorKey = PrivateKey.fromStringDer(process.env.OPERATOR_KEY); + const operatorKey = PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY); const network = process.env.HEDERA_NETWORK; const client = Client.forName(network).setOperator(operatorId, operatorKey); // Generate a metadata key - const metadataKey = PrivateKey.generateED25519(); + const metadataKey = PrivateKey.generateECDSA(); // Initial metadata const metadata = new Uint8Array([1]); // New metadata diff --git a/examples/update-nfts-metadata-of-non-fungible-token.js b/examples/update-nfts-metadata-of-non-fungible-token.js index 0c38f6713b..c7756a7cfc 100644 --- a/examples/update-nfts-metadata-of-non-fungible-token.js +++ b/examples/update-nfts-metadata-of-non-fungible-token.js @@ -32,14 +32,14 @@ async function main() { } const operatorId = AccountId.fromString(process.env.OPERATOR_ID); - const operatorKey = PrivateKey.fromStringDer(process.env.OPERATOR_KEY); + const operatorKey = PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY); const network = process.env.HEDERA_NETWORK; const client = Client.forName(network).setOperator(operatorId, operatorKey); // Generate a metadata key - const metadataKey = PrivateKey.generateED25519(); + const metadataKey = PrivateKey.generateECDSA(); // Generate a supply key - const supplyKey = PrivateKey.generateED25519(); + const supplyKey = PrivateKey.generateECDSA(); // Initial metadata const metadata = new Uint8Array([1]); // New metadata diff --git a/examples/zeroTokenOperations.js b/examples/zeroTokenOperations.js index 4417ed2deb..ed59f61d5c 100644 --- a/examples/zeroTokenOperations.js +++ b/examples/zeroTokenOperations.js @@ -11,7 +11,7 @@ dotenv.config(); //Step 6 is executed through the SDK async function main() { - // Keys should be ED25519 + // Keys should be ECDSA // TODO: Fix the wallet to work with ECDSA if ( process.env.OPERATOR_ID == null || @@ -33,7 +33,7 @@ async function main() { provider, ); - const operatorPrivateKey = hashgraph.PrivateKey.fromStringDer( + const operatorPrivateKey = hashgraph.PrivateKey.fromStringECDSA( process.env.OPERATOR_KEY, ); const operatorPublicKey = operatorPrivateKey.publicKey; @@ -42,7 +42,7 @@ async function main() { process.env.OPERATOR_ID, ); - const alicePrivateKey = hashgraph.PrivateKey.generateED25519(); + const alicePrivateKey = hashgraph.PrivateKey.generateECDSA(); const alicePublicKey = alicePrivateKey.publicKey; try {