Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add murmur on twitch docs #28

Merged
merged 2 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified docs/murmur/assets/discord_bot_in_action.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/murmur/assets/twitch.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions docs/murmur/docs/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ Noun. *a low indistinct but often continuous sound*

---

Murmur is a **keyless crypto wallet protocol** powered by the [Ideal Network](https://docs.idealabs.network) (IDN). Using **timelock encryption** and secure time-based [one-time password](https://www.techtarget.com/searchsecurity/definition/one-time-password-OTP) (OTP) generation, **murmur** allows users to create and execute secure crypto wallets with no mnemonic or secret key. Murmur allows users to access crypto wallets without needing a secret key or mnemonic - it is a truly keyless wallet solution.
Murmur is a **keyless crypto wallet protocol** powered by the [Ideal Network](https://docs.idealabs.network) (IDN). Using **timelock encryption** and secure time-based [one-time password](https://www.techtarget.com/searchsecurity/definition/one-time-password-OTP) (OTP) generation, **murmur** allows users to create and execute secure crypto wallets with no mnemonic or secret key - it is a truly keyless wallet solution. The protocol is designed to be versatile and can be used in a myriad of ways, from [a terminal](./quick_start/local.md) to [twitch chats](./quick_start/twitch.md).

Murmur wallets can be accessed seamlessly across web-enabled devices, providing a plug-and-play solution for app developers to easily integrate web3 capabilities into applications and services with no additional infrastructure or overhead. Murmur wallets can be used by installing a **standalone wallet client** or by using our GDPR-compliant "MMR-as-a-Service" **HTTP API**, which allows you to easily create in-app wallets with seamless interoperability across browsers and other HTTP clients.
Murmur wallets can be accessed seamlessly across web-enabled devices, providing a frictionless plug-and-play solution for app developers to integrate web3 capabilities into applications and services without any additional infrastructure or overhead. Murmur wallets can be used by installing a **standalone wallet client** or by using our **HTTP API**, which allows you to easily create in-app wallets with seamless interoperability across browsers and other HTTP clients.

## Why Murmur?

Expand Down Expand Up @@ -46,7 +46,7 @@ The murmur protocol is very flexible and can be used in various contexts, each w
**From a Browser or JS app**
Murmur can be used from any web-enabled javascript context by relying on the **murmur.js** library to communicate with the **murmur-api**, allowing for the creation and execution of in-app wallets. The [murmur-api](https://github.com/ideal-lab5/murmur-api) is a permissionless HTTP API that simply outsources the computation required to compute and encrypt OTP codes and merkle proofs. [Murmur.js](https://github.com/ideal-lab5/murmur.js) is a javascript library that lets developers easily integrate keyless crypto wallets into their applications. In conjunction with [polkadot.js](https://polkadot.js.org/docs/api), it developers can add a 'wallet-as-a-service' mechanism to their applications with minimal effort.

Check out the [browser integration guide](./quick_start/browser.md) to learn how to integrate murmur into your applications by communicating with the api. See out the library in action by exploring the [murmur-dapp](https://github.com/ideal-lab5/murmur-dapp/) and [murmur discord bot](https://github.com/ideal-lab5/murmur-discord-bot).
Check out the [browser integration guide](./quick_start/browser.md) to learn how to integrate murmur into your applications by communicating with the api. See out the library in action by exploring the [murmur-dapp](https://github.com/ideal-lab5/murmur-dapp/) and [murmur-bots](https://github.com/ideal-lab5/murmur-bots/) repo. which includes both Discord and Twitch bots.

**Standalone Client**
You can also run the murmur wallet using a standalone client. Try the [cli](./quick_start/local.md) for a terminal based client that allows you to create a wallet and execute basic balance transfers.
Expand Down
3 changes: 2 additions & 1 deletion docs/murmur/docs/quick_start/browser.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ npm i @ideallabs/murmur.js axios @polkadot/api
If you want to develop locally, you can run a local Ideal Network node with Docker

``` shell
docker pull ideallabs/etf@latest
docker pull ideallabs/etf:latest
docker run -p 9944:9944 ideallabs/etf --tmp --dev --alice --unsafe-rpc-external
```

*This guide will be updated once the DNS and related configurations for a hosted node have been finalized.*

---

Configure setup axios and polkadot.js instances. We present a useful default here but there are many different ways an application may want to do this.
Expand Down
28 changes: 24 additions & 4 deletions docs/murmur/docs/quick_start/discord.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,41 @@ sidebar_position: 4

# Murmur on Discord

The [murmur-discord-bot](https://github.com/ideal-lab5/murmur-discord-bot), built with [discord.js](https://discord.js.org/) and [murmur.js](https://github.com/ideal-lab5/murmur.js), enables Discord users to easily and securely create and execute crypto transactions on the Ideal Network from within Discord itself. This provides powerful new crypto capabilities for Discord, enabling both discord-wide wallets that can be used interoperably between servers, as well as server-specific crypto wallets and all of the economic implications that come with it.
The [murmur-discord-bot](https://github.com/ideal-lab5/murmur-bots/tree/main/discord), built with [discord.js](https://discord.js.org/) and [murmur.js](https://github.com/ideal-lab5/murmur.js), enables Discord users to easily and securely create and execute crypto transactions on the Ideal Network from within Discord itself. This provides powerful new crypto capabilities for Discord, enabling both discord-wide wallets that can be used interoperably between servers, as well as server-specific crypto wallets and all of the economic implications that come with it.

<div style={{ textAlign: 'center' }}>
![discord_bot](../../assets/discord_bot_in_action.png)
</div>


## Setup

0. **Ideal Network**
This project is in development and requires you run a local IDN node. You can do this easily with Docker by running:

``` shell
docker pull ideallabs/etf:latest
docker run -p 9944:9944 ideallabs/etf --tmp --dev --alice --unsafe-rpc-external
```

1. **Bot Creation on Discord**
Create a new bot from the discord developer portal. You can follow the [official guide](https://discord.com/developers/docs/quick-start/getting-started#configuring-your-bot) to create a bot and add it to a server. Specifically, the bot requires permissions to read and write messages within a Guild. Follow the instruction carefully and this will ultimately result in a `BOT_TOKEN`, which we will use in the next step.

2. **Bot Setup**
Clone the repo https://github.com/ideal-lab5/murmur-discord-bot and create a `.env` file in the root. Create a single entry in the file: `DISCORD_BOT_TOKEN=<your discord bot token>`, then from the root, run:
Clone the repo https://github.com/ideal-lab5/murmur-bots and create a `.env.discord` file in the root directory with the following keys:

```
MAX_RETRIES=number of times to retry failed transactions
SECRET_SALT=any string
DISCORD_BOT_TOKEN=a valid discord bot token for the server
```

then from the root, run:

``` shell
# install dependencies
npm i
# run the bot
npm run start
npm run discord
```

If you configured the bot correctly in step 1 then you will see the bot come online in the specified server. If it doesn't, revisit step (1) and ensure the bot has been granted sufficient privilieges and the token is correct.
Expand All @@ -44,3 +59,8 @@ Example: `@murmur-discord-bot !execute 5Gg1jV56TPVY4Yd3JWpX2a2dQLhUhCu1jdKovMf1R
- **!inspect**: Given a user has a wallet, inspect the wallet address and balance.
Example: `@murmur-discord-bot !inspect`

- **!drip**: Drip 500 tokens to users. This is a totally unprotected test faucet for demo purposes.
Example: `@murmur-discord-bot !drip`

- **!help**: Display a help message
Example: `@murmur-discord-bot !help`
2 changes: 1 addition & 1 deletion docs/murmur/docs/quick_start/local.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Options:
You can use docker to easily run a local IDN validator node (with RPC exposed on localhost:9944) with:

``` shell
docker pull ideallabs/etf@latest
docker pull ideallabs/etf:latest
docker run -p 9944:9944 ideallabs/etf --tmp --dev --alice --unsafe-rpc-external
```

Expand Down
3 changes: 2 additions & 1 deletion docs/murmur/docs/quick_start/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ This is an HTTP connector to the `murmur-api`. It encapsulates communication wit

**Examples**
- The [murmur-cli](https://github.com/ideal-lab5/murmur/tree/main/lib/src/bin/murmur) is a terminal-based way to use murmur.
- The murmur.js library can be used in various javascript based contexts. For example, the [murmur-dapp](https://github.com/ideal-lab5/murmur-dapp/) is a next.js application that demonstrates usage the library in a browser-based context, while the [murmur-discord-bot](https://github.com/ideal-lab5/murmur-discord-bot) functions in a node.js environment, allowing for murmur wallets to be used within Discord.
- The murmur.js library can be used in various javascript based contexts. For example, the [murmur-dapp](https://github.com/ideal-lab5/murmur-dapp/) is a next.js application that demonstrates usage the library in a browser-based context, while the [murmur-bots](https://github.com/ideal-lab5/murmur-bots) functions in a node.js environment. It includes bots that allow server/chat specific Discord and Twitch bots to be created.


### Pallets
Expand All @@ -101,6 +101,7 @@ Explore the [pallets repo](https://github.com/ideal-lab5/pallets/tree/main) to l

## Vulnerabilities, Limitations, Assumption

- Currently there is an issue where sometimes calls to execute the wallet are badly timed and reach the network at the wrong block, which results in the transaction failing. We are still investigating this issue of transaction timing, and are exploring the introduction of retry logic into the murmur libraries.
- Murmur wallets are inherently ephemeral. We currently have not implemented any update functionality, meaning that in its current state all Murmur wallets expire at some point. We will address this in the future.
- Murmur wallets are not recoverable currently. If the user loses their username/seed then they have effectively lost access to their wallet.
- There has been no formal security audit of the IDN or Murmur.
Expand Down
70 changes: 70 additions & 0 deletions docs/murmur/docs/quick_start/twitch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
sidebar_position: 5
---
# Murmur on Twitch

Similar to the [discord bot](./discord.md), Murmur can also be used on [Twitch](https://www.twitch.tv/). The Twitch bot can be added to the chat to allow users to create, execute, and inspect channel-specific Murmur wallets. This guide walks you through how to setup the twitch bot and use it in the chat.

<div style={{ textAlign: 'center' }}>
![twitch_bot](../../assets/twitch.png)
</div>

## Setup

This is a guide for develoeprs to demosntrate lcoal setup and execution of the Twitch bot.

0. **Ideal Network**
This project is in development and requires you run a local IDN node. You can do this easily with Docker by running:

``` shell
docker pull ideallabs/etf:latest
docker run -p 9944:9944 ideallabs/etf --tmp --dev --alice --unsafe-rpc-external
```

1. Clone the murmur-bots repo and navigate to the twitch directory
``` shell
git clone [email protected]:ideal-lab5/murmur-bots.git
cd twitch/
# install dependencies
npm i
```

2. Acquire an Oauth Token for the twitch chat
Follow the directions at the link below to get an Oauth token for the channel you want to add the bot to: https://twitchapps.com/tmi/

You will get an oauth token as output, e.g. `oauth:ptoieoeobe33kfkw3jfnqfzijdjd`. Create a `.env` file in the root of the /twitch directory and create the entry `TWITCH_OAUTH_TOKEN=<your oauth token>`.

3. Configure Env Variables

```
TWITCH_CHANNEL="The twitch channel name (e.g. your username)"
TWITCH_BOT_USERNAME="The name of the bot (e.g. murmur)"
TWITCH_OAUTH_TOKEN="The token from above"
SECRET_SALT="Any 16 characters, don't expose this, more random = better"
```

4. Run the bot

``` shell
npm run start
```

## Usage

- **!auth**: Authenticate with the Murmur API to receive a seed.
Example: `@murmur !auth`

- **!create**: Create a new Murmur wallet for the Discord user for a given validity period (number of blocks from now until the wallet expires). The wallet will be named the same as the discord username.
Example: `@murmur !create 1000`

- **!execute**: Execute a balance transfer by specifying an account address and amount
Example: `@murmur !execute 5Gg1jV56TPVY4Yd3JWpX2a2dQLhUhCu1jdKovMf1RwcpYeh2 1000`

- **!inspect**: Given a user has a wallet, inspect the wallet address and balance.
Example: `@murmur !inspect`

- **!drip**: Drip 500 tokens to users. This is a totally unprotected test faucet for demo purposes.
Example: `@murmur !drip`

- **!help**: Display a help message
Example: `@murmur !help`
1 change: 1 addition & 0 deletions docs/murmur/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const sidebars = {
'quick_start/local',
'quick_start/browser',
'quick_start/discord',
'quick_start/twitch',
],
},
{
Expand Down