## User manual

### 1. Creating a deal

A deal can be created on a site with BitDeals support, or in our [Deal Module](https://git.bitdeals.org/private/apostol-dm) web interface.

The deals can be two types: In a **Prepayment** deal a seller receives your money before receiving your feedback. In a **Postpayment** deal - after, and there is possible a customer to refund money in case of a dispute depending of a deal arbitrator's decision. If a customer leave a negative feedback, but an arbitrator is not involved in the deal, the money goes to our favor.

After payment of a deal amount, the order status changes from **Created** to **Paid**. And then to **Completed** immediately, or after your feedback in Postpayment deals.

After a deal creation is necessary to verify its signature, we sign all our deals with our [PGP key](https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xC061D33CE0CDF25D1378BBD3DA2C8764788006B3 "DA2C 8764 7880 06B3") digital signature. The example of new signed deal is available hereinafter.

An identificators of users in a deals are their bitcoin addresses. Check your bitcoin address is participating in your deal as a customer.

Also pay attention to a users **rating**, consisting of the number of deals and number of successfully completed deals from the last hundred.

The deal states a bitcoin sum and payment address. For accept deal payment a transaction should be confirmed by inclusion in one bitcoin block for a time stated in "**until**" field, otherwise the deal will be Canceled and the payment will be sent back to the customer's address.

Please check a deal "**leave-before**" field date, before which you can leave a deal feedback.

An example of deal data:

```
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

BitDeal:
  order: Created
  type: Postpayment
  at: http://example.com
  date: 2020-11-06 16:00:00 UTC
  seller:
    address: mjTbMV3cbjtGxYMKV2uKZpZt5v7LRp8TBJ
    rating: 200+, 99%
  customer:
    address: mukvhKgb6CVz36o7Cnu1pnzckqktf7dwcU
    rating: 10, 100%
  payment:
    address: 3N376PKK9qWaX6MSjF9XTKNQRhpeDfD89jg
    until: 2020-11-06 20:00:00 UTC
    sum: 0.0123 BTC
  feedback:
    leave-before: 2020-11-20 16:00:00 UTC

-----BEGIN PGP SIGNATURE-----
Version: cc

iQEzBAEBCgAdFiEEHx6AT+33g1dSZXThknAyJg0n59cFAl3CIXMACgkQknAyJg0n
59ffTQf/X98auPSoMmb76HIf3l1YCiG5KL27ohBf1GiMQfKgWtpE6CTb6RkiGjld
ziSzCq9+y8PZOrLdrgd+ZiKH/hVrJ40BrQNfqtAA3xv+MwzbZ28J0UbVlVIQlHto
+/8waZaHUsZoXi/Z7xEs=
=QVjJ
-----END PGP SIGNATURE-----
```

### 2. Leaving a deal feedback

In addition to the possibility of **leave feedback on a deal site**, if necessary, you can leave a negative deal feedback through our Bitmessage bots. For this, send a signed by the customer's private bitcoin key message to the bot with "**negative**" in the subject and the deal payment address and your feedback text line in the message body. The bots addresses are specified in our [PGP key](https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xC061D33CE0CDF25D1378BBD3DA2C8764788006B3 "DA2C 8764 7880 06B3") comment. 

An example of negative feedback message:

```
3D2oetdNuZUqQHPJmcMDDHYoqkyNVsFk9r
Save yourself the trouble!
H9n843mvWrnK70Vudo8IyI0UhIfy4CpKSW8m10S5LfksKBfnGp6NYh7alg+M8hboefnGY1WM=
```

### 3. Seller cancellation of a deal

If you can't perform a deal, **you can cancel it**. There is no commission on a Canceled deals.

For cancel a deal you should send a signed by the seller's private bitcoin key message with "**cancel**" in the subject and the deal payment address and your cancel reason text line in the message body. The bots addresses are specified in our [PGP key](https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xC061D33CE0CDF25D1378BBD3DA2C8764788006B3 "DA2C 8764 7880 06B3") comment.

The message format is equal to feedback message in the example above.

### 4. Deal creation trust system

The trust system is based on a list of sites you trust to create a deals with your participation.

With new user registration on a site, the site URL is added to the trust list automatically.

The account data changes takes place through our Bitmessage bot. The bots addresses are specified in our [PGP key](https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xC061D33CE0CDF25D1378BBD3DA2C8764788006B3 "DA2C 8764 7880 06B3") comment. For add a site you need to send a signed by the user private bitcoin key message with "**update**" in the subject and current date and the site URL in the message body to the bot. More details about bot usage you can get by send a message to the bot containing "**help**" in the subject.

An example of add URL in trusted list message:

```
2020-11-06
https://example.org
H9n843mvWrnK70Vudo8IyI0UhIfy4CpKSW8m10S5LfksKBfnGp6NYh7alg+M8hboefnGY1WM=
```

### 5. User account registration

A new customer and seller registrations occurs automatically with deal creation. For an account registration allowing to create a deals and participate in them as arbitrator you will need: **Bitcoin public key, RSA PGP public key with your site URL in the key ID comment** (in form: `http[s]://\<string\>`).

Your private PGP key must be used by DealModule on your site to sign deals. If necessary, you can change your account PGP key.

The account registration takes place through our Bitmessage bot. The bots addresses are specified in our [PGP key](https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xC061D33CE0CDF25D1378BBD3DA2C8764788006B3 "DA2C 8764 7880 06B3") comment. For registration you need to send a message with "**new**" in the subject to the bot containing stated account data in the message body. More details about bot usage you can get by send a message to the bot containing "**help**" in the the subject.

In addition to the user account, you will need the Deal Module - the program that provides an interfaces for creating and modifying user accounts and deals.

You can get the [Deal Module](https://git.bitdeals.org/private/apostol-dm) source code and [REST-API](https://git.bitdeals.org/private/apostol-dm/src/branch/master/doc/REST-API-ru.md) documentation, also the [Docker image](https://hub.docker.com/r/bitdeals/apostol-dm) is available.

