0

I have a very simple application that uses Django as the underlaying web framework, and our app got a bit stranded by the move from Walletconnect's services in the migration from v1 to v2 that was final back in the end of June. We previously used a dist of v1's extended "web3 provider" which has been more or less wiped off the map by Ethereum Provider (detailed here)

<script type="text/javascript" src="https://unpkg.com/@walletconnect/web3-provider"></script>
<script type="text/javascript"  src="https://unpkg.com/web3@latest/dist/web3.min.js"></script>
...
let web3, provider, selectedAccount, accountData, contract;
...
const providerOptions = {
    walletconnect: {
        package: WalletConnectProvider,
        options: {
            infuraId: "ABCDEFGHIJK24..."
        }
    },
...
var request = new XMLHttpRequest();
    request.open('GET', login_url, true);

    request.onload = function () {
        if (request.status >= 200 && request.status < 400) {
            // Success!
            var resp = JSON.parse(request.responseText);
            var token = resp.data;
            web3.eth.getAccounts().then((accounts) => {
                //var msg = web3.utils.toHex(token);
                var msg = token;
                var from = accounts[0];

                web3.eth.personal.sign(msg, from, function (err, result) {
                    if (err) {
                        if (typeof onTokenSignFail == 'function') {
                            onTokenSignFail(err);
                        }
                        console.log("Failed signing message \n" + msg + "\n - " + err);
                    } else {
                        console.log("Signed message: " + result);
                        if (typeof onTokenSignSuccess == 'function') {
                            onTokenSignSuccess(result);
                        }
                        loginWithSignature(...)

I've tried reaching out on Discord, and while several others conveyed the same concerns, there didn't seem to be a solution. I'm in no position to wait for Walletconnect to build anything in the form of a dist, and I need to arrive to a solution ASAP:

In short, I'm just trying to verify via an Ethereum personalSign TX (0 gas) signature that the wallet address of the account is the account they're logging into. The trick here is that I'm trying to support wallets like Ledger, QR scan etc. from mobile, and as extensible of functionality as possible - but since WalletConnect and any form of SIWE I can find is based on React/Node (remember, I can't use the word 'import' in my JS!), am I completely stranded?

I'm looking at writing an entire react app just to authenticate and talk to my app, surely this is excessive right? Perhaps should I be building more of this in web3.py? How should I be authenticating my web3 users?

1 Answer 1

0

I understand you're facing challenges in migrating your Django application from WalletConnect v1 to v2.

From my experience, for verifying the wallet address of the user, you can use the personal_sign method provided by web3.py to sign a message with the user's private key and verify the signature on the server side.

I prefer to use React, Node.js and React Native to build this kind of application since JavaScript is working well on web3 projects.

I agree with you to use React for the frontend development and you can use Django as a backend with React and React Native frontend.

Thanks,

Ari

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.