---
description: How to create a promise?
---

# Creating a promise

<figure><img src="https://3220983521-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzrTE605r0sr8i4nFSjEI%2Fuploads%2FluhkXQkTs5dKuFJ8fWq3%2Fimage.png?alt=media&#x26;token=11bfd805-fbd2-4410-82de-5035c5c57e5e" alt="Using the menu to navigate to the dashboard"><figcaption><p>Go to the dashboard from the menu.</p></figcaption></figure>

<figure><img src="https://3220983521-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzrTE605r0sr8i4nFSjEI%2Fuploads%2FFdPGQwWwIPmz51ql7dJ1%2Fimage.png?alt=media&#x26;token=95b6b67f-a237-4ef1-9e4b-3745412d1a8b" alt="Creating a promise using the App"><figcaption><p>Click "New promise" to create a promise.</p></figcaption></figure>

There are two ways of creating a promise:

* using the App ;
* from the contract.

## Creating a promise using the App

Using the App to create a promise will allow its content to get verified, and spare you the trouble of sending it to IPFS, and eventually to Arweave.&#x20;

<figure><img src="https://3220983521-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzrTE605r0sr8i4nFSjEI%2Fuploads%2FuiGYcoz1KiZHHupYCgkt%2Fimage.png?alt=media&#x26;token=67f204cf-7e30-4bc7-a229-e2a01aa34167" alt="The window displayed for creating a promise on the App"><figcaption><p>The 'Create promise' drawer on the App.</p></figcaption></figure>

### Filling up the form

The process is rather straightforward:

1. Enter a name for your promise (max 70 characters).
2. Input data for at least one participant:
   * Name (min 2 - max 30 characters) ;
   * Ethereum address (a valid Ethereum address) ;
   * Twitter username (optional ; a valid Twitter handle).
3. Add as many participants as needed.
4. Choose whether you want to send the files to Arweave (if you do so, you will need to sign a message to connect your wallet to the Bundlr network [sending-to-arweave-with-bundlr](../ipfs-and-arweave/sending-to-arweave-with-bundlr "mention")).
5. Upload as many files as needed (max 10 MB).

{% hint style="warning" %}
You must be included as a participant, so you won't be able to delete the row that includes your address.
{% endhint %}

{% hint style="warning" %}
You cannot add duplicate Ethereum addresses.
{% endhint %}

{% hint style="warning" %}
You need to upload file by file ; you can't upload a folder directly.
{% endhint %}

{% hint style="info" %}
Files won't be uploaded to IPFS or Arweave until you click the **Create** button.
{% endhint %}

### Approving transactions

Once you click **Create**, the process of "uploading" to IPFS / Arweave and submitting the transaction will start.

If you chose not to send the content to Arweave, you will only need to confirm one transaction, which will create the promise contract holding all its information.

If you chose to send the content to Arweave, there are a few additional steps:

1. **Funding your Bundlr wallet**: you will be prompted to confirm a transaction, that will transfer the required amount in MATIC to your Bundlr wallet ; it will be used for sending the files to the Arweave blockchain.
2. **Authorizing Bundlr**: you will be asked to sign a message to authorize Bundlr to send the files on Arweave.

Once you have completed these steps, the promise will be created, and available both in the **Explore promises** and the **Dashboard** pages.

## Creating a promise from the contract

The promise creation window provides a link to create the promise by directly interacting with the contract.

{% hint style="warning" %}
If you create a promise from the contract, without using the App, we won't be able to verify that the files have indeed been uploaded to IPFS & Arweave.

Therefore, the promise will be displayed with the tag ":warning:**Not verified**" on the App UI.
{% endhint %}

<figure><img src="https://3220983521-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzrTE605r0sr8i4nFSjEI%2Fuploads%2FoB6cQ9XpPzOUcYS5Qe6J%2Fimage.png?alt=media&#x26;token=fbd3fef1-4cb9-4445-b22d-9d79d9311e25" alt="Navigating to the contract from the App to create a promise"><figcaption><p>Navigating to the contract to create a promise.</p></figcaption></figure>

Once in the `createPromiseContract` function, you will need to provide the following parameters:

<table><thead><tr><th width="252.5">Parameter</th><th width="100">Example input</th><th>Info</th></tr></thead><tbody><tr><td><code>_promiseName</code></td><td>New promise</td><td>Any string.<br>Max length is 70 characters.</td></tr><tr><td><code>_ipfsCid</code></td><td>bafybe...ci</td><td>Any IPFS CID.</td></tr><tr><td><code>_arweaveId</code></td><td>E1X...WU</td><td>Any Arweave ID.</td></tr><tr><td><code>_encryptedProof</code></td><td>...</td><td>It doesn't matter here, since it won't be able to get verified. At least one character must be provided.</td></tr><tr><td><code>_partyNames</code></td><td>['Bob']</td><td><p>An array of strings.</p><p>It needs to be encapsulated in brackets: <code>[...]</code>.</p><p>Each name must be in quotes: <code>'name'</code>. </p><p>Names must be separated by a comma: <code>'name', 'name'</code>. </p></td></tr><tr><td><code>_partyTwitterHandles</code></td><td>['bobtwitter']</td><td><p>An array of strings.</p><p>It needs to be encapsulated in brackets: <code>[...]</code>.</p><p>Each handle must be in quotes: <code>'handle'</code>. </p><p>Handles must be separated by a comma: <code>'handle', 'handle'</code>.<br>The @ must not be provided.<br>For no handle, an empty string must be supplied: <code>''</code>.</p></td></tr><tr><td><code>_partyAddresses</code></td><td>[0x000...00]</td><td><p>An array of addresses.</p><p>It needs to be encapsulated in brackets: <code>[...]</code>.</p><p>Addresses must be separated by a comma: <code>'0x000...', '0x000...'</code>.</p></td></tr></tbody></table>

{% hint style="warning" %}
You must put your address as the first one in the array, otherwise the transaction will be reverted.
{% endhint %}

{% hint style="info" %}
All fields need to be filled up in order to submit the transaction.
{% endhint %}

{% hint style="info" %}
The arrays `_partyNames`_,_ `_partyTwitterHandles` and `_partyAddresses` need to have the same length.
{% endhint %}

When all the fields have been filled correctly, you can submit the transaction, and refresh the App to see your promise displayed.

## Related resources

| App                                                                                                                                                               |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Creating a promise (NewPromiseDrawer)](https://github.com/polar0/chainlink-fall-2022-hackathon/blob/main/frontend/components/user-dashboard/NewPromiseDrawer.js) |
| [Uploading to IPFS](https://github.com/polar0/chainlink-fall-2022-hackathon/blob/main/frontend/systems/tasks/uploadToIPFS.js)                                     |
| [Uploading to Arweave](https://github.com/polar0/chainlink-fall-2022-hackathon/blob/main/frontend/systems/tasks/uploadToArweave.js)                               |
| [Encrypting hashes (AES 256)](https://github.com/polar0/chainlink-fall-2022-hackathon/blob/main/frontend/systems/tasks/encryptAES256.js)                          |

| Contracts                                                                                                                                      |
| ---------------------------------------------------------------------------------------------------------------------------------------------- |
| [PromiseFactory.sol](https://github.com/polar0/chainlink-fall-2022-hackathon/blob/main/backend/hardhat/contracts/PromiseFactory.sol)           |
| [PromiseFactory (tests)](https://github.com/polar0/chainlink-fall-2022-hackathon/blob/main/backend/hardhat/test/unit/PromiseFactory.test.js)   |
| [PromiseContract.sol](https://github.com/polar0/chainlink-fall-2022-hackathon/blob/main/backend/hardhat/contracts/PromiseContract.sol)         |
| [PromiseContract (tests)](https://github.com/polar0/chainlink-fall-2022-hackathon/blob/main/backend/hardhat/test/unit/PromiseContract.test.js) |

| Chainlink                                                                                                                                                     |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [VerifyStorage.sol](https://github.com/polar0/chainlink-fall-2022-hackathon/blob/main/backend/hardhat/contracts/VerifyStorage.sol)                            |
| [VerifyStorage (unit tests)](https://github.com/polar0/chainlink-fall-2022-hackathon/blob/main/backend/hardhat/test/unit/VerifyStorageMock.test.js)           |
| [VerifyStorage (staging tests)](https://github.com/polar0/chainlink-fall-2022-hackathon/blob/main/backend/hardhat/test/staging/VerifyStorage.staging.test.js) |
| [External Adapter - storage verification](https://github.com/polar0/chainlink-fall-2022-hackathon/tree/main/backend/chainlink-ea-storage-verification)        |
| [Operator contract](https://mumbai.polygonscan.com/address/0xd4d1fe6ff0a871ccf37bcfbce3135f548e5f05b5)                                                        |
