Connecting Aragon DAOs to webhooks 
Tags: blockchain, webdev, javascript
Published: 2020-01-31 07:10:42

Hey everyone!

We have been busy at the [MESG Foundation](https://mesg.com/?utm_source=Devto&utm_medium=blog&utm_campaign=AragonDAO) working on the first milestone of the [MESG integration with Aragon DAOs](https://github.com/aragon/nest/issues/190) and also starting the first iteration of our testnet running on Tendermint.

The goal of the first milestone is to create a backend application connecting Aragon DAOs to a webhook connector. This will include all the core Aragon apps built and maintained by Aragon One, listed here: https://github.com/aragon/aragon-apps.

Here are the results of what we have done:

##Architecture
The application has been created using the [MESG SDK](https://mesg.com/mesg-sdk/?utm_source=Devto&utm_medium=blog&utm_campaign=AragonDAO) that we have developed internally. It consists of enabling the flow of data from and to services using processes.

For the Aragon integration, we developed a process that connects an [Ethereum service](https://github.com/mesg-foundation/service-ethereum-contract) to a [Webhook service](https://github.com/mesg-foundation/service-webhook) as follows:

```

+------------+                                +-------------+
|            |                                |             |
| Aragon DAO |                                |   Webhook   |
|            |                                |             |
+-----+------+                                +------+------+
      |                                              ^
      |                                              |
    listen                                        trigger
      |                                              |
      v                                              |
+------------+                                +-------------+
|            |                                |             |
|  Ethereum  |                                |   Webhook   |
|  services  |                                |   service   |
|            |                                |             |
+-----+------+                                +------+------+
      |                                              ^
      |                                              |
      |                                              |
    event                                          call
      |             +------------------+             |
      |             |                  |             |
      +------------>+     Process      +-------------+
                    |                  |
                    +------------------+

```

`
`
##Step-by-step explanation
1. Multiple MESG Ethereum services are running and actively listening for events from specific applications of an Aragon DAO.
2. When an Ethereum event is detected, the service emits it to the MESG Engine.
3. If the event matches a MESG Process, the process gets triggered. 
4. In this case, the process executes the task call of the Webhook service.
5. The Webhook service creates a HTTP request and executes it.

##Demo
Check out the demo video: https://www.youtube.com/watch?v=Mji0ee1l4z8

##Source
Check out the source code of this demo and see how to install it on the Github repo: https://github.com/mesg-foundation/aragon 

##Current limitations
	
* The Ethereum service used has some limitations due to its design. It works only with one specific smart contract. As Aragon DAOs rely on one smart contract per application per DAO, the service has to be deployed multiple times with different configurations. For the next milestones, we will use a generic-purpose Ethereum service that only needs to be deployed once and works with any event of any smart contracts. The process will have to filter the exact events to match.
	
* The Ethereum service requires an external provider to connect to Ethereum. We will work on a version that directly integrates geth configured as a light client.
	
* The webhook service could used a secret token or to sign the request in order to prove the origin and prevent abuse. I would like to hear your feedback and suggestions on this one.
	
* Getting the ABI and smart contract address of the Aragon App is manual. Is there any way to programmatically get the ABI corresponding to the specific version used by a DAO? Can an Aragon application get the address and ABI of other applications within the same DAO?


We'd love to hear your feedback and suggestions!

We started to work on the next milestone: create an Aragon app that manages the connection between the users’ DAO and the webhook.
While completing this milestone, we will start to run the MESG application on our testnet so we should be able to do a public and live demo.