Error: Assertion failed after funding a new wallet
Issue Description
Receiving Error: Assertion when attempting to initialize Platform connection after funding a new wallet.
Mnemonic (non production)
{"mnemonic":"need grab endorse wine around fuel lawn flame tide section original boss"}
Expected Behavior
After funding a new wallet with tDash a user should be able to initialize and connect to platform.
Current Behavior
Throws Error: Assertion failed

Steps to Reproduce (for bugs)
using this repo https://github.com/HunterSides/DDR-React
clone & npm install & npm start open localhost:3000 open console & fund wallet address given reload page after funding wallet
Process Point Failure
Platform connection initialization after funding given wallet address with tDash.
Your Environment
@dash-incubator/dapp-sdk": "*" Chrome & Firefox latest Windows 10 64 bit Link to your project:
What is the version of dash SDK is used? Can you also provide a link to the repo with @dash-incubator/dapp-sdk
@markin-io
Version 0.14.2 - https://github.com/dash-incubator/dapp-sdk Required as a dependency in package.json - https://github.com/HunterSides/DDR-React/blob/main/package.json Used here - https://github.com/HunterSides/DDR-React/blob/main/src/views/UploadPage.js
However I just rechecked and I'm now getting this error instead. It happens before I'm given an address to be funded.
(I believe this specific issue has already been reported by @ICJR)

@HunterSides thank you. dash-incubator/dapp-sdk needs to update Dash SDK to v3.22.3.
From what I see, currently, the project is on 3.21.7
Perhaps the issue itself is better transferred to https://github.com/dash-incubator/dapp-sdk as well?
This is a side project from Dash Incubator, and we don't have an access to it.
@HunterSides - am I right in saying "it looks like ICJR needs to update the dapp sdk - Dash SDK package to v3.22.3 from v3.21.7"?
ICJR - any update here?
@SamKirby22 Updated dash dependency to use the latest version. I am now seeing RuntimeError: abort(both async and sync fetching of the wasm failed). Build with -s ASSERTIONS=1 for more info. after I fund a new testnet wallet with tDash.
@ICJR @HunterSides thank you for the provided details and updates, we added this to our backlog
@ICJR @HunterSides I launched the DDR-React project. Thank you for driving the Dash React App initiative - frontend Dash efforts are crucial for project development.
I reproduced the issue and I think that the underlying problem is that currently, dash SDK requires an extra webpack configuration that provides Node.JS polyfills for browsers. We are currently working out a solution for proper bundling for the web without the additional configuration to improve the developer experience.
Having in mind that you are working with the CRA, you can not alter your webpack config without the eject (which is not desirable).
Here's what I suggest to do as a workaround for now:
- In
@dash-incubator/dapp-sdkproject:- Configure
webpack.typescript.config.jsto provide all required polyfills. This comment will help. - Add
"browser": "./dist/dapp.js"to thepackage.json(This would make web-apps using dapp-sdk look for dapp.js bundle instead of the typescript build) - Build and publish to NPM
- Configure
- Update
@dash-incubator/dapp-sdkinDDR-Reactto a newer version and try running app again.
@markin-io dapp-sdk is already providing the node polyfills during bundling https://github.com/dash-incubator/dapp-sdk/blob/main/webpack.typescript.config.js#L45 using node-polyfill-webpack-plugin
@ICJR thank you. We're currently in progress with a proper SDK bundle for the web.
@ICJR please update dash to v0.22.12 and retest, you could also try getting rid of Node node polyfills if they were only used for dash
This one is for Hunter to check but would be good for ICJR to take a look too - as impacting both bounties.
Aha, all right. @HunterSides @ICJR please also check out a new section in the documentation about using primitives https://github.com/dashevo/platform/tree/master/packages/js-dash-sdk#primitives-and-essentials
If you need more PlatformProtocol essentials exposed, please let us know. For the first iteration we only did ones that used by our internal platform test suite.
@markin-io

Still receiving the errors above. I removed the node polyfill plugin provider, and updated dash npm to the latest version. Have you guys tested on another web app using just the dash npm package and a normal testnet platform connection?
Asking so I can just tear everything apart on my end to find the issue.
@ICJR yes, there it is dash-react-starter-app.zip
@markin-io
Tried a few things still no luck
Received More than one instance of dashcore-lib found. Please make sure that you are not mixing instances of classes of the different versions of dashcore. used npm dedupe warning won't go away.
Also noticed the following endpoints
/org.dash.platform.dapi.v0.Core/getStatus
/org.dash.platform.dapi.v0.Core/subscribeToTransactionsWithProofs
Constantly take 60186ms to respond throwing a 503/504 error.
@ICJR dashcore-lib duplicate shouldn't cause this kind of an error.
As of getStatus - yes it is quite slow, it's sitting in our optimizations list.
subscribeToTransactionsWithProofs is a stream, and it is expected to disconnect after a minute due to a nginx configuration of the masternode. (It reconnects afterwards)
From what I see this is some wasm issue (SDK internally uses wasm code), and probably related to a second layer of bundling in dapp-sdk.
So far we tested only dash -> Frontend app use case, but dash -> second-tier-wrapper -> Frondend app isn't covered yet.
We would appreciate any additional information and debugging of the case with the second tier wrappers for dash library. Will add it to our backlog.
For now to unblock your endeavor I might suggest using dash directly in DDR React.
If using dapp-sdk is a must-have for you, there are two options that could possibly solve the problem:
- Use
dapp-sdkas a git submodule and directly refer to itssrcfrom the DDR-React project (instead of installingdapp-sdkvia npm). - Instead of a webpack bundle, do just TypeScript (
tsc) build fordapp-sdk
Both cases will avoid producing a wrapping bundle around the dash
@markin-io
Still receiving the errors above. I removed the node polyfill plugin provider, and updated dash npm to the latest version. Have you guys tested on another web app using just the dash npm package and a normal testnet platform connection?
Just reiterating ICJR here, I also still receive the errors after updating.
@HunterSides thanks. Please try out one of the steps https://github.com/dashevo/platform/issues/328#issuecomment-1158683430
@markin-io @ICJR Attempting to use dapp-sdk as a git submodule gives me
