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

Can't deploy contract #239

Open
diepvuongthang opened this issue May 10, 2022 · 14 comments
Open

Can't deploy contract #239

diepvuongthang opened this issue May 10, 2022 · 14 comments

Comments

@diepvuongthang
Copy link

Note: Not all sections may be relevant, but please be as thorough while remaining concise as possible. Remove this Notice and any sections that don't feel pertinent.

If you are unsure if something is a bug, start a thread in the "discussions" tab above..

Describe the bug
A clear and concise description of what the bug is.

Reproduction steps
Please include code snippets, with console.log output, any contract ABI, contract address, network and the full error.

Environment:
Please include anything that may be useful in diagnosing the issue. Node vs Browser? Geth vs Parity vs Ganache? Third Party tools, like Hardhat? Mobile vs. Desktop?

Search Terms
Screen Shot 2022-05-11 at 00 15 17

Often similar issues have come up before. Include any search terms you have tried in this repository's Issues (including closed issues) and "Discussions", so if there are matching issues, we can be sure to add those keywords and link this issue to it, making it easier for people to find in the future.

@Kalina-Todorova
Copy link

Could you share a bit more context - what are you trying to achieve and if possible the code of the smart contract in a txt format so that we can debug?

@yogeshrt
Copy link

\hedera\node_modules@hethers\logger\lib\index.js:186
var error = new Error(message);
^

Error: transaction 0.0.48162428@1663101679.615115293 failed precheck with status INVALID_SIGNATURE (code=INVALID_SIGNATURE, version=providers/1.2.1)
at Logger.makeError (C:\Users\Yogesh\hedera\node_modules@hethers\logger\lib\index.js:186:21)
at DefaultHederaProvider. (C:\Users\Yogesh\hedera\node_modules@hethers\providers\lib\base-provider.js:690:38)
at step (C:\Users\Yogesh\hedera\node_modules@hethers\providers\lib\base-provider.js:78:23)
at Object.throw (C:\Users\Yogesh\hedera\node_modules@hethers\providers\lib\base-provider.js:59:53)
at rejected (C:\Users\Yogesh\hedera\node_modules@hethers\providers\lib\base-provider.js:51:65)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
reason: 'transaction 0.0.48162428@1663101679.615115293 failed precheck with status INVALID_SIGNATURE',
code: 'INVALID_SIGNATURE',
transaction: {
transactionId: '0.0.48162428-1663101679-615115293',
hash: '0xf9b33156f07d33265aa22fa3cd031e48e7cecda781e00db096f592f44c9a2bb88543dbfe8f49c7da023a9d8340593bde',
from: '0x0000000000000000000000000000000002dee67c',
data: '0x30783630383036303430353233343830313536313030313035373630303038306664356235303630343035313631303362633338303338303631303362633833333938313031363034303831393035323631303032663931363130303763353635623630343035313831383135323333393036303030393037666464663235326164316265326338396236396332623036386663333738646161393532626137663136336334613131363238663535613464663532336233656639303630323030313630343035313830393130333930613333333630303039303831353236303230383139303532363034303930323035353631303039343536356236303030363032303832383430333132313536313030386435373830383166643562353035313931393035303536356236313033313938303631303061333630303033393630303066336665363038303630343035323334383031353631303031303537363030303830666435623530363030343336313036313030346335373630303033353630653031633830363333313363653536373134363130303531353738303633373061303832333131343631303036353537383036333935643839623431313436313030396335373830363361393035396362623134363130306335353735623630303038306664356236303430353136303132383135323630323030313562363034303531383039313033393066333562363130303865363130303733333636303034363130323031353635623630303136303031363061303162303331363630303039303831353236303230383139303532363034303930323035343930353635623630343035313930383135323630323030313631303035633536356236303430383035313830383230313832353236303037383135323636323662636161333762356232623736306339316236303230383230313532393035313631303035633931393036313032346235363562363130306438363130306433333636303034363130323232353635623631303065383536356236303430353139303135313538313532363032303031363130303563353635623333363030303930383135323630323038313930353236303430383132303534383231313135363130313462353736303430353136323436316263643630653531623831353236303230363030343832303135323630316136303234383230313532376636393665373337353636363636393633363936353665373432303734366636623635366532303632363136633631366536333635303030303030303030303030363034343832303135323630363430313630343035313830393130333930666435623333363030303930383135323630323038313930353236303430383132303830353438343932393036313031366139303834393036313032623635363562393039313535353035303630303136303031363061303162303338333136363030303930383135323630323038313930353236303430383132303830353438343932393036313031393739303834393036313032396535363562393039313535353035303630343035313832383135323630303136303031363061303162303338343136393033333930376664646632353261643162653263383962363963326230363866633337386461613935326261376631363363346131313632386635356134646635323362336566393036303230303136303430353138303931303339306133353036303031393239313530353035363562383033353630303136303031363061303162303338313136383131343631303166633537363030303830666435623931393035303536356236303030363032303832383430333132313536313032313235373830383166643562363130323162383236313031653535363562393339323530353035303536356236303030383036303430383338353033313231353631303233343537383038316664356236313032336438333631303165353536356239343630323039333930393330313335393335303530353035363562363030303630323038303833353238333531383038323835303135323832356238313831313031353631303237373537383538313031383330313531383538323031363034303031353238323031363130323562353635623831383131313135363130323838353738333630343038333837303130313532356235303630316630313630316631393136393239303932303136303430303139333932353035303530353635623630303038323139383231313135363130326231353736313032623136313032636435363562353030313930353635623630303038323832313031353631303263383537363130326338363130326364353635623530303339303536356236333465343837623731363065303162363030303532363031313630303435323630323436303030666466656132363436393730363637333538323231323230643830333834636535383465313031633562393265346565396237383731323632323835303730646263643264373166393936303166306634666365636432333634373336663663363334333030303830343030333330303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303634',
chainId: 0,
r: '',
s: '',
v: 0
},
transactionHash: '0xf9b33156f07d33265aa22fa3cd031e48e7cecda781e00db096f592f44c9a2bb88543dbfe8f49c7da023a9d8340593bde'
}

@yogeshrt
Copy link

We are trying to submit a small smart contract on hedera DLT using hethers. If needed I can share sample index.js for review/comments.

@Kalina-Todorova
Copy link

We suspect that it might be related to the way the wallet was initialized. You could take a look at the docs: https://docs.hedera.com/hethers/application-programming-interface/signers#new-hethers.wallet-less-than-externallyownedaccount-greater-than-provider
If this doesn't help you, please send us the whole code snippet so that we can verify.

@yogeshrt
Copy link

node .\hethers_test.js
The balance is: 999256518542
Wallet address = Promise { '0x0000000000000000000000000000000002dee67c' }
before contractfactory
before factory.deploy
C:\Users\Yogesh\hedera\node_modules@hethers\logger\lib\index.js:186
var error = new Error(message);
^

Error: transaction 0.0.48162428@1663162799.267505558 failed precheck with status INVALID_SIGNATURE (code=INVALID_SIGNATURE, version=providers/1.2.1)
at Logger.makeError (C:\Users\Yogesh\hedera\node_modules@hethers\logger\lib\index.js:186:21)
at DefaultHederaProvider. (C:\Users\Yogesh\hedera\node_modules@hethers\providers\lib\base-provider.js:690:38)
at step (C:\Users\Yogesh\hedera\node_modules@hethers\providers\lib\base-provider.js:78:23)
at Object.throw (C:\Users\Yogesh\hedera\node_modules@hethers\providers\lib\base-provider.js:59:53)
at rejected (C:\Users\Yogesh\hedera\node_modules@hethers\providers\lib\base-provider.js:51:65)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
reason: 'transaction 0.0.48162428@1663162799.267505558 failed precheck with status INVALID_SIGNATURE',
code: 'INVALID_SIGNATURE',
transaction: {
transactionId: '0.0.48162428-1663162799-267505558',
hash: '0x2b982d71144f109751251140a9cc064126c4f1265258c4e32d30dd259b56239ae1ad8eeade6c1fb418442ade612b4fae',
from: '0x0000000000000000000000000000000002dee67c',
data: '0x30783630383036303430353233343830313536313030313035373630303038306664356235303630343035313631303362633338303338303631303362633833333938313031363034303831393035323631303032663931363130303763353635623630343035313831383135323333393036303030393037666464663235326164316265326338396236396332623036386663333738646161393532626137663136336334613131363238663535613464663532336233656639303630323030313630343035313830393130333930613333333630303039303831353236303230383139303532363034303930323035353631303039343536356236303030363032303832383430333132313536313030386435373830383166643562353035313931393035303536356236313033313938303631303061333630303033393630303066336665363038303630343035323334383031353631303031303537363030303830666435623530363030343336313036313030346335373630303033353630653031633830363333313363653536373134363130303531353738303633373061303832333131343631303036353537383036333935643839623431313436313030396335373830363361393035396362623134363130306335353735623630303038306664356236303430353136303132383135323630323030313562363034303531383039313033393066333562363130303865363130303733333636303034363130323031353635623630303136303031363061303162303331363630303039303831353236303230383139303532363034303930323035343930353635623630343035313930383135323630323030313631303035633536356236303430383035313830383230313832353236303037383135323636323662636161333762356232623736306339316236303230383230313532393035313631303035633931393036313032346235363562363130306438363130306433333636303034363130323232353635623631303065383536356236303430353139303135313538313532363032303031363130303563353635623333363030303930383135323630323038313930353236303430383132303534383231313135363130313462353736303430353136323436316263643630653531623831353236303230363030343832303135323630316136303234383230313532376636393665373337353636363636393633363936353665373432303734366636623635366532303632363136633631366536333635303030303030303030303030363034343832303135323630363430313630343035313830393130333930666435623333363030303930383135323630323038313930353236303430383132303830353438343932393036313031366139303834393036313032623635363562393039313535353035303630303136303031363061303162303338333136363030303930383135323630323038313930353236303430383132303830353438343932393036313031393739303834393036313032396535363562393039313535353035303630343035313832383135323630303136303031363061303162303338343136393033333930376664646632353261643162653263383962363963326230363866633337386461613935326261376631363363346131313632386635356134646635323362336566393036303230303136303430353138303931303339306133353036303031393239313530353035363562383033353630303136303031363061303162303338313136383131343631303166633537363030303830666435623931393035303536356236303030363032303832383430333132313536313032313235373830383166643562363130323162383236313031653535363562393339323530353035303536356236303030383036303430383338353033313231353631303233343537383038316664356236313032336438333631303165353536356239343630323039333930393330313335393335303530353035363562363030303630323038303833353238333531383038323835303135323832356238313831313031353631303237373537383538313031383330313531383538323031363034303031353238323031363130323562353635623831383131313135363130323838353738333630343038333837303130313532356235303630316630313630316631393136393239303932303136303430303139333932353035303530353635623630303038323139383231313135363130326231353736313032623136313032636435363562353030313930353635623630303038323832313031353631303263383537363130326338363130326364353635623530303339303536356236333465343837623731363065303162363030303532363031313630303435323630323436303030666466656132363436393730363637333538323231323230643830333834636535383465313031633562393265346565396237383731323632323835303730646263643264373166393936303166306634666365636432333634373336663663363334333030303830343030333330303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303634',
chainId: 0,
r: '',
s: '',
v: 0
},
transactionHash: '0x2b982d71144f109751251140a9cc064126c4f1265258c4e32d30dd259b56239ae1ad8eeade6c1fb418442ade612b4fae'
}

@yogeshrt
Copy link

heathers_test.txt

@yogeshrt
Copy link

const eoaAccount = {
    account: "0.0.48162428",
    privateKey: "0x302e020100300506032b65700422042091882ca433ba668a484dedbbb6319cd11a580ebe1b491d23fdd7a534f6cf2669" 
};

const wallet2 = new hethers.Wallet(eoaAccount, provider);
const factory = new hethers.ContractFactory(abi, bytecode, wallet2);

@yogeshrt
Copy link

Provisioned wallet with eoaAccount way with account and privatekey ( Note this is on testnet hence sharing keys/account Id). Thanks in advance for your support.

@Kalina-Todorova
Copy link

Hi @yogeshrt I think the privateKey is the issue as it should be without the 0x prefix. Could you try and let us know if this works?

@yogeshrt
Copy link

@Kalina-Todorova I was about to resolve issues with the below notes

  1. Account generation from https://portal.hedera.com/register create Privatekey with ED25519
  2. Account generated through the program using PrivateKey.generateECDSA() can be a way to create with private key ECDSA pfa reference program for the same
    accountgenerate_ecdsa.txt
  3. Account genarated with step (2) has 0 hbar, so cant be used for deploy contracts
  4. Used program to transfer balance from account[ generated from step 1] to account [ generated from step 2]
    account_transfer_hbar.txt
  5. account [ generated from step 2] is ready to be used for deploying the contract
    deploy_contract.txt

Note: This program requires cleanup. But the scenario is successfully tested with it.

@yogeshrt
Copy link

#234 This commit mentioned adding support for ED25519, but not sure why we still require the ECDSA key with hethers.

@bmino
Copy link

bmino commented Oct 17, 2022

I experienced the same issue. Initializing a wallet using a non-ECDSA private key was the issue. Some options now include:

const wallet = new hethers.Wallet({
    account: accountId,
    privateKey: privateKey,
    isED25519Type: true,
});

@Kalina-Todorova
Copy link

Let us will look into it and get back to you

@natanasow
Copy link
Collaborator

@bmino Hi, just tried to create new accounts (ECDSA and ED25519) on testnet, and both works fine. Also, tried to pass the private key with and without the 0x prefix, still working. If you still having a issue, I could send a fully working code snippet with contract deployment or you can post yours and I would try to debug it.

  • for ED25519
const provider = hethers.providers.getDefaultProvider('testnet');
const eoaAccount = {
    account: '0.0.28542425',
    privateKey: '0x...',
    isED25519Type: true
};
// @ts-ignore
const wallet = new hethers.Wallet(eoaAccount, provider);
  • for ECDSA
const provider = hethers.providers.getDefaultProvider('testnet');
const eoaAccount = {
    account: '0.0.48647112',
    privateKey: '0x...'
};
// @ts-ignore
const wallet = new hethers.Wallet(eoaAccount, provider);

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

No branches or pull requests

5 participants