dashpay / platform

L2 solution for seriously fast decentralized applications for the Dash network
https://dashplatform.readme.io/docs/introduction-what-is-dash-platform
MIT License
67 stars 39 forks source link

Testnet network not working #118

Open denniswong34 opened 3 years ago

denniswong34 commented 3 years ago

The testnet network is down. Is there any other network that i could use for development??

Expected Behavior Testent network connected without error

Current Behavior (node:9023) UnhandledPromiseRejectionWarning: PluginInjectionError: Failed to perform standard injections with reason: Plugin ChainPlugin of type Standard onStart failed: getaddrinfo ENOTFOUND testnet-seed.darkcoin.qa at /home/builduser/app/dashjs/node_modules/@dashevo/wallet-lib/src/types/Account/_initializeAccount.js:57:16 at processTicksAndRejections (internal/process/task_queues.js:97:5) (node:9023) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 3) (node:9023) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Network config file

@dashevo/dapi-client/lib/networkConfigs.js module.exports = { evonet: { seeds: [ 'seed-1.evonet.networks.dash.org', 'seed-2.evonet.networks.dash.org', 'seed-3.evonet.networks.dash.org', 'seed-4.evonet.networks.dash.org', 'seed-5.evonet.networks.dash.org', ], network: 'evonet', }, local: { dapiAddresses: ['127.0.0.1'], network: 'regtest', }, testnet: { seeds: [ 'test.dnsseed.masternode.io', 'testnet-seed.darkcoin.qa', 'testnet-seed.dashpay.io' ], network: 'testnet', }, };

Possible Solution Steps to Reproduce (for bugs) client.getWalletAccount()

Context

Your Environment Nodejs version: v12.20.0 @dashevo/dapi-client: 0.16.0 @dashevo/dashcore-lib: 0.18.16

shumkov commented 3 years ago

You are using an outdated version of DAPI Client. Please update to the latest stable (0.18).

denniswong34 commented 3 years ago

After upgraded the latest version, i got another error..

I have run the following command and install the latest version dash@3.18.1

npm install dash

After running the sample code from "Usage" section.

const Dash = require("dash");

const client = new Dash.Client({ network: "testnet", wallet: { mnemonic: "arena light cheap control apple buffalo indicate rare motor valid accident isolate", }, });

// Accessing an account allow you to transact with the Dash Network client.getWalletAccount().then(async (account) => { console.log("Funding address", account.getUnusedAddress().address);

const balance = account.getConfirmedBalance(); console.log("Confirmed Balance", balance);

if(balance > 0){ // Creating an identity is the basis of all interactions with the Dash Platform const identity = await client.platform.identities.register()

// Prepare a new document containing a simple hello world sent to a hypothetical tutorial contract
const document = await platform.documents.create(
  'tutorialContract.note',
  identity,
  { message: 'Hello World' },
);

// Broadcast the document into a new state transition
await platform.documents.broadcast({create:[document]}, identity);

} });

It got following exception....

warn: Running on a NodeJS env without any specified adapter. Data will not persist. (node:5572) UnhandledPromiseRejectionWarning: Error: Request failed with status code 502 at createError (C:\Users\denni\git\dashjs\node_modules\axios\lib\core\createError.js:16:15) at settle (C:\Users\denni\git\dashjs\node_modules\axios\lib\core\settle.js:17:12) at IncomingMessage.handleStreamEnd (C:\Users\denni\git\dashjs\node_modules\axios\lib\adapters\http.js:236:11) at IncomingMessage.emit (events.js:327:22) at endReadableNT (_stream_readable.js:1220:12) at processTicksAndRejections (internal/process/task_queues.js:84:21) (node:5572) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2) (node:5572) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. Funding address yLptqWxjgTxtwKJuLHoGY222NnoeqYuN8h Confirmed Balance 219589000 (node:5572) UnhandledPromiseRejectionWarning: Error: InstantLock waiting period for transaction dd5ffe5fb8db122b50d00e14d8cfd9ac4d02b7d88f493c0fdd9dfdd9fa28e922 timed out at Timeout._onTimeout (C:\Users\denni\git\dashjs\node_modules\@dashevo\wallet-lib\src\types\Account\Account.js:228:18) at listOnTimeout (internal/timers.js:549:17) at processTimers (internal/timers.js:492:7) (node:5572) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 3)

thephez commented 3 years ago

I've run the Usage example successfully several times (locally and via https://replit.com/@thephez/js-dash-sdk-usage#index.js) and it created an identity. The example is primarily to show syntax and doesn't include any error handling so I'm not sure about that part. In fact, the document creation part of the example will definitely throw an error if executed because it refers to a contract that hasn't been defined - again it's just showing syntax.

For more extensive examples (that are periodically tested), refer to https://dashplatform.readme.io/docs/tutorials-introduction

denniswong34 commented 3 years ago

Hi thephez,

Thanks for the reply. I could successfully get the confirmed balance, but I still got the exception even comment all document related code. The exception will not throw instantly. You need to wait for a long time.

image

Here is the code that i'm using: `const Dash = require("dash");

const client = new Dash.Client({ network: "testnet", wallet: { mnemonic: "arena light cheap control apple buffalo indicate rare motor valid accident isolate", unsafeOptions: { skipSynchronizationBeforeHeight: 415000, // only sync from start of 2021 }, }, });

// Accessing an account allow you to transact with the Dash Network client.getWalletAccount().then(async (account) => { console.log("Funding address", account.getUnusedAddress().address);

const balance = await account.getConfirmedBalance(); console.log("Confirmed Balance", balance);

if(balance > 0){ // Creating an identity is the basis of all interactions with the Dash Platform //const identity = await client.platform.identities.register() console.log("balance >0"); } });`