# Quick Start Example

{% hint style="info" %}
This is a simple example of how to connect MetaMask and sign a message, you don't have to do it in the exact same way.
{% endhint %}

## Connect to MetaMask

1\. Add the Web3\&MetaMask plugin element on the page.

2\. Add a button, open workflow on Button click and add ***Connect To Metamask*** action<br>

<figure><img src="https://163529783-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGXQwv3RyfW5Yi0SKag6n%2Fuploads%2FE7sbLtxm67YV64nx40GK%2Fconnect_mm.png?alt=media&#x26;token=9ea66e60-e784-4004-ad21-2459bf015125" alt=""><figcaption></figcaption></figure>

3\. Add a text element on the page, to show the connected wallet address.

4\. In the text element, click on ***Insert dynamic data***

<div align="center"><figure><img src="https://163529783-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGXQwv3RyfW5Yi0SKag6n%2Fuploads%2F6to62ZCx5kLu7pcyN99O%2Fdynamic.png?alt=media&#x26;token=f65e572d-7266-4fa1-9188-dd56fb7cfa7c" alt=""><figcaption></figcaption></figure></div>

5\. Find *Web3\&Metamask element* in the list and select it.\
&#x20;   A dropdown with all element states will open, choose *Wallet Address*<br>

<figure><img src="https://163529783-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGXQwv3RyfW5Yi0SKag6n%2Fuploads%2Fq8Qvi8MIkjyhoWUBTMXB%2Fwallet_address%20(1).png?alt=media&#x26;token=26c16eae-2980-44a0-a4f0-6d90d758c067" alt=""><figcaption></figcaption></figure>

#### **Done!** You can now connect your app to MetaMask!

## Sign and save Signature

Let's say you need to save the users signature somewhere for later use.\
You can run the action to sign a message similar to how we did the connection, on button click, or, for example, when an event is triggered.\
Most real-world use case is to sign a message right after the wallet connection so that's what we will do\
\
1\. In the Workflows, add the event ***MetaMask Connected*** from Web3\&MetaMask element

<figure><img src="https://163529783-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGXQwv3RyfW5Yi0SKag6n%2Fuploads%2FYyZ7BvKRshFbiTSTpy1y%2Fadd_event.png?alt=media&#x26;token=5779c5c9-d4e4-4745-874d-6e82a1e081b7" alt=""><figcaption></figcaption></figure>

2\. In the actions, similar to how we added Connect action earlier, find the ***Sign action*** and add it.\
You need to add a message to be signed, it can be anything, including dynamic data like today's date or app name.

<figure><img src="https://163529783-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGXQwv3RyfW5Yi0SKag6n%2Fuploads%2F6gOfksx4HUKtFX9Rr20m%2Fsign.png?alt=media&#x26;token=d0ab294b-371f-4424-ad2a-a49e6a2b1cd3" alt=""><figcaption></figcaption></figure>

3\. Add another event called, ***Signed*** this will trigger only after the user will sign the message\
4\. Now here the signature will be available to you, let's save it in a custom state to use later.\
Add an action to Set state, select any element on the page where the state will be "attached to", and create a custom state of text type.

{% hint style="info" %}
Creating custom states is a Bubble standard feature, it is not related to the plugin
{% endhint %}

<figure><img src="https://163529783-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGXQwv3RyfW5Yi0SKag6n%2Fuploads%2FO3nt9k6kTSoovyCM7jy1%2Fcreate_state.png?alt=media&#x26;token=13ce4625-c45b-4467-94cf-c5d622b1684a" alt=""><figcaption></figcaption></figure>

5\. In the state value, select ***This Web3\&Metamask Sign: Signature*** state

<figure><img src="https://163529783-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGXQwv3RyfW5Yi0SKag6n%2Fuploads%2FImj3Bu0C7R84BFopt0dU%2Fsignature_state.png?alt=media&#x26;token=50fb7d4c-3c33-417d-9025-60d432c131d5" alt=""><figcaption></figcaption></figure>

For this example, I will add the saved signature in the text element to be shown to the user.

<figure><img src="https://163529783-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGXQwv3RyfW5Yi0SKag6n%2Fuploads%2FWnI6jWTCbTxVjc9O8NpG%2Fsignature_text.png?alt=media&#x26;token=5c909004-dc3d-449b-aac0-a5926529bc2a" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Saving signature in your own custom state or database is important because the plugin signature state will be re-written if you will run the sign action again somewhere else.
{% endhint %}

\
**Done!** \
**This example is available** [**here**](https://bubble.io/page?type=page\&name=sample\&id=ezplugins-demo-2\&test_plugin=1612784921335x464807902025875460_current\&tab=tabs-1)\
\
If you have questions or need additional help, feel free to ask in our Discord: <https://discord.com/invite/HWfg853N6d>
