Open barrybecker4 opened 1 month ago
The .env.example
file has THIRDPARTY_RPC_URL
, but the code in index.ts uses RPC_URL
. Could that be the problem?
If I make that fix, then running the test seems to get further, but now gives a different error:
$ npm run start -- generateProofs
> sdk-example@1.0.0 prestart
> npm run build
> sdk-example@1.0.0 build
> tsc
> sdk-example@1.0.0 start
> ts-node index.ts generateProofs
=============== generate proofs ===============
=============== user did ===============
did:polygonid:polygon:amoy:2*********************************************v
================= generate Iden3SparseMerkleTreeProof =======================
================= push states to rhs ===================
================= publish to blockchain ===================
E:\projects\identity\js-sdk-examples\node_modules\ethers\src.ts\utils\errors.ts:694
error = new Error(message);
^
Error: could not coalesce error (error={ "code": -32000, "message": "transaction underpriced: gas tip cap 1000000000, minimum needed 25000000000" }, payload={ "id": 10, "jsonrpc": "2.0", "method": "eth_sendRawTransaction", "params": [ "0x02f901f48301388280843b9aca00843b9aca1e831f770c941a4cc30f2aa0377b0c3bc9848766d90cb440412480b9018428f88a65000d9f012aef4f8e73b958814d07bda15f730ae2ebdbb9555bb55fafce5e1302012aef4f8e73b958814d07bda15f730ae2ebdbb9555bb55fafce5e5903e0c69e22095981d35c9c794ee0edde9aa5f9c96104b7982a734fd4005402215011a84d00000000000000000000000000000000000000000000000000000000000000011238533658334c0f546e18e0697948baffe6086071ff37339a57b9ae5edb27f829fcf86c5b0c26f88b503b9fce1794369ab402851862d6cdf79ee349fedf0af104f2e0897e2052f03f64dfc1066fd4f5bcbf2ab869acd3fa8e19630c371d8b8f13a9b8de383cfbba155f3531a7d2d4d3466fb4edcbc52b971041da0f5121dddf1bd77110c3c070c6eb13d95d1bdd850449bc1e38d9b842ad9bdcfa3d2cb2131b0bb7c28549ee04600df922ec9c2ce58d138b195cc6de3dd2f3420c25667eb077072df85dc695029aed3106d0ee91099f8112baea6f4c3b267da9fffdd13ff9002b19087a26a29ae71e2d0e9fcfe273df5164783122a417e2e6acaa0c43778fecc001a09ad5d8014af750efed1587f2ad2ac6e4556ffabbd2908820541cbcf6e31a3d7fa04c662c14b95b42d5aa4fd6a26ae03f3c93dc6300176b20a1f5812682b85ed19c" ] }, code=UNKNOWN_ERROR, version=6.8.0)
at makeError (E:\projects\identity\js-sdk-examples\node_modules\ethers\src.ts\utils\errors.ts:694:21)
at JsonRpcProvider.getRpcError (E:\projects\identity\js-sdk-examples\node_modules\ethers\src.ts\providers\provider-jsonrpc.ts:976:25)
at E:\projects\identity\js-sdk-examples\node_modules\ethers\src.ts\providers\provider-jsonrpc.ts:526:45
at processTicksAndRejections (node:internal/process/task_queues:95:5) {
code: 'UNKNOWN_ERROR',
error: {
code: -32000,
message: 'transaction underpriced: gas tip cap 1000000000, minimum needed 25000000000'
},
payload: {
method: 'eth_sendRawTransaction',
params: [
'0x02f901f48301388280843b9aca00843b9aca1e831f770c941a4cc30f2aa0377b0c3bc9848766d90cb440412480b9018428f88a65000d9f012aef4f8e73b958814d07bda15f730ae2ebdbb9555bb55fafce5e1302012aef4f8e73b958814d07bda15f730ae2ebdbb9555bb55fafce5e5903e0c69e22095981d35c9c794ee0edde9aa5f9c96104b7982a734fd4005402215011a84d00000000000000000000000000000000000000000000000000000000000000011238533658334c0f546e18e0697948baffe6086071ff37339a57b9ae5edb27f829fcf86c5b0c26f88b503b9fce1794369ab402851862d6cdf79ee349fedf0af104f2e0897e2052f03f64dfc1066fd4f5bcbf2ab869acd3fa8e19630c371d8b8f13a9b8de383cfbba155f3531a7d2d4d3466fb4edcbc52b971041da0f5121dddf1bd77110c3c070c6eb13d95d1bdd850449bc1e38d9b842ad9bdcfa3d2cb2131b0bb7c28549ee04600df922ec9c2ce58d138b195cc6de3dd2f3420c25667eb077072df85dc695029aed3106d0ee91099f8112baea6f4c3b267da9fffdd13ff9002b19087a26a29ae71e2d0e9fcfe273df5164783122a417e2e6acaa0c43778fecc001a09ad5d8014af750efed1587f2ad2ac6e4556ffabbd2908820541cbcf6e31a3d7fa04c662c14b95b42d5aa4fd6a26ae03f3c93dc6300176b20a1f5812682b85ed19c'
],
id: 10,
jsonrpc: '2.0'
},
shortMessage: 'could not coalesce error'
}
The root problem seems to be
"transaction underpriced: gas tip cap 1,000,000,000, minimum needed 25,000,000,000" }
(I added the commas)
I made another change to increase the max gas fee in hopes that that would allow the test to run. Now I get this error.
> ts-node index.ts generateProofs
=============== generate proofs ===============
=============== user did ===============
did:polygonid:polygon:amoy:2********************************************1
================= generate Iden3SparseMerkleTreeProof =======================
================= push states to rhs ===================
================= publish to blockchain ===================
E:\projects\identity\js-sdk-examples\node_modules\ethers\src.ts\utils\errors.ts:694
error = new Error(message);
^
Error: insufficient funds for intrinsic transaction cost (transaction="0x02f901f683013882808506fc23ac0085174876e80083228fe9941a4cc30f2aa0377b0c3bc9848766d90cb440412480b9018428f88a65000dc7126f8c287c7299cf2b89441866e3f8967a45647a76c7b54fd6dcb01302126f8c287c7299cf2b89441866e3f8967a45647a76c7b54fd6dcb023701941ee2871e06cec8a3c014cbec58194ebba3746d03572da5889f40fedd85e5e5697de000000000000000000000000000000000000000000000000000000000000000116f1903e96b598266132951da8cffda84764489b72a673f3b2c1a5a513a2ba150dd35a62235e5605d4cab52b5a056123a93ade81d59586d602882761846934212ac1a365b6f94f64779951e829fd9328bafec8b5c146267693a1d018b2293d9c0a5cdf9bedce84d2a70f9f66d89035924ba2c9df3a35273f4f7a71af0d3819fd0b033fea85ab8255b3289a224dc568361e2beda059d1f571200b6926cbc115aa150174d27af6a514cf39b2351b16b710cc2edb7c45cf40133a5e681d98af86e12d29697a0179678a959a10a6334a3becdf02b9878c50493bc409333257ce02d902e3634fad4c0ab18a33b3073e1516ede672d15055f1b69e6fdccaa58cbbcbf9c080a0bfccba2ee88267ecef59f724a09b2e1cf89de4791a15803c0d95385d885a7eeea05bc942b028fc754a10ce442f5c7d246ba1a6dcbc75c740b866dd363992644897", info={ "error": { "code": -32000, "message": "insufficient funds for gas * price + value: balance 100000000000000000, tx cost 226506500000000000, overshot 126506500000000000" } }, code=INSUFFICIENT_FUNDS, version=6.8.0)
at makeError (E:\projects\identity\js-sdk-examples\node_modules\ethers\src.ts\utils\errors.ts:694:21)
at JsonRpcProvider.getRpcError (E:\projects\identity\js-sdk-examples\node_modules\ethers\src.ts\providers\provider-jsonrpc.ts:942:33)
at E:\projects\identity\js-sdk-examples\node_modules\ethers\src.ts\providers\provider-jsonrpc.ts:526:45
at processTicksAndRejections (node:internal/process/task_queues:95:5) {
code: 'INSUFFICIENT_FUNDS',
transaction: '0x02f901f683013882808506fc23ac0085174876e80083228fe9941a4cc30f2aa0377b0c3bc9848766d90cb440412480b9018428f88a65000dc7126f8c287c7299cf2b89441866e3f8967a45647a76c7b54fd6dcb01302126f8c287c7299cf2b89441866e3f8967a45647a76c7b54fd6dcb023701941ee2871e06cec8a3c014cbec58194ebba3746d03572da5889f40fedd85e5e5697de000000000000000000000000000000000000000000000000000000000000000116f1903e96b598266132951da8cffda84764489b72a673f3b2c1a5a513a2ba150dd35a62235e5605d4cab52b5a056123a93ade81d59586d602882761846934212ac1a365b6f94f64779951e829fd9328bafec8b5c146267693a1d018b2293d9c0a5cdf9bedce84d2a70f9f66d89035924ba2c9df3a35273f4f7a71af0d3819fd0b033fea85ab8255b3289a224dc568361e2beda059d1f571200b6926cbc115aa150174d27af6a514cf39b2351b16b710cc2edb7c45cf40133a5e681d98af86e12d29697a0179678a959a10a6334a3becdf02b9878c50493bc409333257ce02d902e3634fad4c0ab18a33b3073e1516ede672d15055f1b69e6fdccaa58cbbcbf9c080a0bfccba2ee88267ecef59f724a09b2e1cf89de4791a15803c0d95385d885a7eeea05bc942b028fc754a10ce442f5c7d246ba1a6dcbc75c740b866dd363992644897',
info: {
error: {
code: -32000,
message: 'insufficient funds for gas * price + value: balance 100000000000000000, tx cost 226506500000000000, overshot 126506500000000000'
}
},
shortMessage: 'insufficient funds for intrinsic transaction cost'
}
My current balance is 0.1 MATIC (100000000000000000 wei) The transaction cost is about 0.2265 MATIC (226506500000000000 wei) I'm short by about 0.1265 MATIC (126506500000000000 wei)
Probably the README should give some information about what sort of real costs will be incurred when running the tests. I went to https://faucet.polygon.technology/ to get some more matic (0.2 POL) - which may not even be enough. I am also a bit confused about the currency units and conversion rates - ETH, POL, Matic, wei, gwei, dollars?
Yay! After adding the additional funds, I can now run the proof. I probably won't have sufficient funds to run it again though...
> ts-node index.ts generateProofs
=============== generate proofs ===============
=============== user did ===============
did:polygonid:polygon:amoy:2****************************h
================= generate Iden3SparseMerkleTreeProof =======================
================= push states to rhs ===================
================= publish to blockchain ===================
0x82b8f675c35f38f6ea0633fe51e730cc3afe534d9f9b003dea534d2a270d10e6
================= generate credentialAtomicSigV2 ===================
valid: true
================= generate credentialAtomicMTPV2 ===================
[
W3CCredential {
id: 'urn:95450371-a117-4e9a-b966-965a1b1a4e02',
'@context': [
'https://www.w3.org/2018/credentials/v1',
'https://schema.iden3.io/core/jsonld/iden3proofs.jsonld',
'https://raw.githubusercontent.com/iden3/claim-schema-vocab/main/schemas/json-ld/kyc-v3.json-ld'
],
type: [ 'VerifiableCredential', 'KYCAgeCredential' ],
credentialSubject: {
id: 'did:polygonid:polygon:amoy:2***************************8h',
birthday: 19960424,
documentType: 99,
type: 'KYCAgeCredential'
},
issuer: 'did:polygonid:polygon:amoy:2************************************h',
expirationDate: '2361-03-21T19:14:48.000Z',
refreshService: undefined,
issuanceDate: '2024-10-13T14:19:34.025Z',
credentialSchema: {
id: 'https://raw.githubusercontent.com/iden3/claim-schema-vocab/main/schemas/json/KYCAgeCredential-v3.json',
type: 'JsonSchema2023'
},
credentialStatus: {
id: 'https://rhs-staging.polygonid.me/node?state=75ce6cca04201db5177b82e29874e10d9f9af0440c4f4daf60a8b23a805aeb1e',
type: 'Iden3ReverseSparseMerkleTreeProof',
revocationNonce: 4851
},
proof: [ [BJJSignatureProof2021], [Iden3SparseMerkleTreeProof] ]
}
]
{"pi_a":["2765105235462597712896021987192949000872318538722518136355024748158255629685","1579068556773713442137864985755654756963314894000905684630581835554064635885","1"],"pi_b":[["7641874725820143731625984081966973809989743169850587903847664351405644965866","16883677241559792497803939592529634120176479754047192071921036580212714366171"],["4189839077459116458426493557480904769062515821352161370542986414912454352885","20086155633109627246647176254573080921748096119709436792645487611046098586907"],["1","0"]],"pi_c":["11915619396359318488717898890053942261615648371469160748266841481009508733563","5246234180719448251912934761372132216138340724654392596539197093501058947522","1"],"protocol":"groth16","curve":"bn128"}
valid: true
valid: true
Describe the bug I get 'ECONNREFUSED' when running 'npm run start -- generateProofs'
To Reproduce
I am trying to follow the instructions to run the examples in the README. My .env file looks like this (with some values sanitized). I put my metamask wallet key for the WALLET_KEY value, but maybe I should have set it as the THIRD_PARTY_WALLET_KEY.
I get the following error when I run $ npm run start -- generateProofs
Expected behavior The test should run successfully.
Environment info (please complete the following information):