Sign-In with Ethereum plugin

:information_source: Summary Enable Sign-In with Ethereum on Discourse
:hammer_and_wrench: Repository Link GitHub - spruceid/discourse-siwe-auth: Discourse plugin for SIWE authentication
:open_book: Install Guide How to install plugins in Discourse

Features

This plugin enables Sign-In with Ethereum on Discourse

Configuration

Requirements

  • A Discourse forum that is self-hosted or that is hosted with a provider that allows third party plugins, like Communiteq.

Note

The Sign-In with Ethereum plugin still requires users to enter an email to associate with their accounts after authenticating for the first time. If the user owns an ENS address, it will be the default selected username. Once an email address is associated, users can then sign in using the SIWE option at any time.

Enabling the Plugin

To install and enable the plugin on your self-hosted Discourse use the following
method: Access your container’s app.yml file (present in /var/discourse/containers/)

cd /var/discourse
nano containers/app.yml

Add the plugin’s repository URL to your container’s app.yml file:

hooks:
  before_code:                             # <-- added
    - exec:                                # <-- added
        cmd:                               # <-- added
          - gem install rubyzip            # <-- added
  after_code:
    - exec:
      cd: $home/plugins
      cmd:
        - sudo -E -u discourse git clone https://github.com/discourse/docker_manager.git
        - sudo -E -u discourse git clone https://github.com/spruceid/discourse-siwe-auth.git   # <-- added

Follow the existing format of the docker_manager.git line; if it does not
contain sudo -E -u discourse then insert - git clone https://github.com/spruceid/discourse-siwe-auth.git.

Rebuild the container:

cd /var/discourse
./launcher rebuild app

To disable it either remove the plugin or uncheck discourse siwe enabled at
(Admin Settings → Plugins → discourse-siwe → discourse siwe enabled ).

Discourse Plugins Enable plugin at settings

Enable WalletConnect

WalletConnect support can be provided via Infura. Create a new Infura project in order to receive a new Infura project ID. Then go to the settings (same as before) and paste the ID in that location and click on the checkmark. Add infura id to plugin settings

JSON RPC

As an alternative, you can configure the WalletConnect instance with JSON RPC endpoints, as shown below:

Doing so will supersede the Infura ID configuration option for WalletConnect specifically, other uses of an Infura ID won’t be affected.

Add JSON RPC endpoints

Edit the message statement

By default a statement is added to the messages: Sign-in to Discourse via Ethereum. To edit this statement access the settings (same as before) and update it. Add infura id to plugin settings

14 Likes

some discussion about dependencies here Discourse can't find gems specified in the plugin

Found this on GitHub, seems to be actively developed too. Seems like it allows web3 logins (still require email addresses after logging in with your wallet).

However the dev is facing an issue that prevents installing the plugin and bootstrapping discourse after. Full details in the issue below. Maybe it’s a really simple issue and someone here can submit a PR for the dev.

1 Like

Hold my beer :wink:
Solution in the Github issue.

3 Likes

That is awesome, trying it right now. I hope this helps te developer aswell :grinning:

EDIT: I end up with the same error it seems even tho it looks like the gem is being installed:

version 2.3.0.
Successfully installed rubyzip-2.3.2
1 gem installed
FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate' failed with return #<Process::Status: pid 777 exit 1>
Location of failure: /usr/local/lib/ruby/gems/2.7.0/gems/pups-1.1.1/lib/pups/exec_command.rb:117:in `spawn'
exec failed with the params {"cd"=>"$home", "hook"=>"db_migrate", "cmd"=>["su discourse -c 'bundle exec rake db:migrate'"]}
bootstrap failed with exit code 1
** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one.
./discourse-doctor may help diagnose the problem.

Can you please do this?

2 Likes

Going through the logs, posting things that I believe might be relevant.

@moderators maybe a topic split for this? There is no official topic from this plugin, I don’t think the dev is on meta.

I, [2022-07-04T16:43:46.394301 #1]  INFO -- : > cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate'
rake aborted!
Gem::ConflictError: Unable to activate eth-0.5.1, because openssl-3.0.0 conflicts with openssl (~> 2.2)

I don’t see any other errors at this moment (or I’m missing them, logs are long)

1 Like

To be honest, I’m not following the gist of what’s going on here. :slightly_smiling_face: @RGJ and @michaeld have the power to split, so perhaps they’ll do the honours and manage it in a more sensitive manner than I will. :slightly_smiling_face::crossed_fingers: (or, alternatively, pick the post to split from, name the category you want it to go in, and let me know a title to give it :+1:)

1 Like

My suggestion is split from here:

https://meta.discourse.org/t/web-3-0-features/203321/19?u=marcp

The most suitable category would be support or #plugins (i’m not sure… how do we deal with plugins that are not developed by a member of Meta… maybe he will join meta or we can invite him through github to meta someday?)

EDIT:

Seems this is the dev, so he is on meta? @w4ll3

@michaeld made a PR for this yesterday, but it’s not merged yet. You can use https://github.com/communiteq/discourse-siwe-auth/ in the meanwhile.

3 Likes

Can confirm this works! Thanks Michael.

1 Like

So to sum it up, you need both the before_code as described in the issue Cannot Install Plugin on Self-Hosted Discourse server - rbsecp256k1 · Issue #15 · spruceid/discourse-siwe-auth · GitHub AND the newer version of the eth gem that I made the (currently unmerged) PR for.

5 Likes

A bit late here on the official forum, but hey - Rocco here from the Spruce team.

Thanks again @michaeld for the fixes there, it took care of it and we updated the documentation from our side. Also thanks for bringing this all up - we’re still actively developing / maintaining things around Sign-In with Ethereum.

Was also curious here - is there a path to eventually making this an officially supported plugin :grinning: - we love Discourse and want to figure out how to extend this functionality to instances that aren’t self-hosted.

2 Likes

Just for clarity, Communiteq does support this plugin on our managed hosting plans, it’s available on the Professional plan and higher.

3 Likes

My apologies about that!

No need to apologize! The official hosting does not have it (yet?). I just wanted to emphasize our commitment to these web3 plugins.

3 Likes

Yeah - not an officially supported plugin, unfortunately.

But definitely kudos for the support from Communiteq! Anything to help support Web3 users is really awesome.

From our end we’re working on various different ways to support Sign-In with Ethereum adoption and Discourse was always at the top of our list which is why after we standardized it EIP-4361 we created the plugin. The other thing that has been top of mind is around what else to add to it - with the custom RPC provider being one of the first pieces.

3 Likes

This plugin is not working for me there is some issue with plugin not able to install , can somebody share alternative or help with this one @michaeld @RGJ

You will need to share details if you want help.

1 Like

@RGJ when i try to install this plugin , rebuild fails with this error

You are specifying the gem rbsecp256k1 in /var/www/discourse/plugins/discourse-siwe-auth/plugin.rb, however it does not exist!
Looked for: /var/www/discourse/plugins/discourse-siwe-auth/gems/2.7.6/specifications/rbsecp256k1-5.1.0.gemspec