Hey! These docs are for version 0.18.0, which is no longer officially supported. Click here for the latest version, 0.21.0!

DashPay

Data contract enabling wallets to provide a user centric payment experience

Overview

DashPay is one of the first applications of Dash Platform's data contracts . At its core DashPay is a data contract that enables a decentralized application that creates bidirectional direct settlement payment channels between identities.

The DashPay contract enables an improved Dash wallet experience with features including:

  • User Centric Interaction: DashPay brings users front and center in a cryptocurrency wallet. Instead of sending to an address, a user sends directly to another user. Users will have a username, a display name, an avatar and a quick bio/information message.

  • Easy Payments: Once two users have exchanged contact requests, each can make payments to the other without manually sharing addresses via emails, texts or BIP21 QR codes. This is because every contact request contains the information (an encrypted extended public key) required to send payments to the originator of the request. When decrypted, this extended public key can be used by the recipient of the contact request to generate payment addresses for the originator of the contact request.

  • Payment History: When a contact is established, a user can easily track the payments they have sent to another user and the payments that they have received from that other user. A user will have an extended private key to track payments that are received from the other user and an extended public key to track payments that are sent to that other user.

  • Payment Participant Protection: The extended public keys in contact requests are encrypted in such a way that only the two users involved in a contact's two way relationship can decrypt those keys. This ensures that when any two users make payments in DashPay, only they know the sender and receiver while 3rd parties do not.

📘

For previews of an updated Dash mobile wallet UI based on the DashPay contract or to join the alpha test program, please visit the DashPay landing page at dash.org.

Details

The contract defines three document types: contactRequest, profile and contactInfo. ContactRequest documents are the most important. They are used to establish relationships and payment channels between Dash identities. Profile documents are used to store public facing information about Dash identities including avatars and display names. ContactInfo documents can be used to store private information about other Dash identities.

Establishing a Contact

  1. Bob installs wallet software that supports DashPay.
  2. Bob registers an identity and then creates a username through DPNS.
  3. Bob searches for Carol by her username. Behind the scenes this search returns the unique identifier for Carol's identity. An example of doing this can be seen in the Retrieve a Name tutorial.
  4. Bob sends a contact request containing an encrypted extended public key to Carol. This establishes a one way relationship from Bob to Carol.
  5. Carol accepts the request by sending a contact request containing an encrypted extended public key back to Bob. This establishes a one way relationship from Carol to Bob.
  6. Bob and Carol are now contacts of one another and can make payments to each other by decrypting the extended public key received from the other party and deriving payment addresses from it. Since both have established one way relationships with each other, they now have a two way relationship. If Bob gets a new device, he can use his recovery phrase from step one and restore his wallet, contacts (including Carol) and payments to and from his contacts.
Contact-based WalletContact-based Wallet

Contact-based Wallet

Implementation

DashPay has many constraints as defined in the DashPay data contract. Additionally, the DashPay data triggers defined in js-dpp enforce additional validation rules related to the contactRequest document.

👍

DashPay DIP

Please refer to the DashPay Dash Improvement Proposal (DIP) for more extensive background information and complete details about the data contract.

{
   "profile":{
      "indices":[
         {
            "unique":true,
            "properties":[
               {
                  "$ownerId":"asc"
               }
            ]
         },
         {
            "properties":[
               {
                  "$ownerId":"asc"
               },
               {
                  "$updatedAt":"asc"
               }
            ]
         }
      ],
      "required":[
         "$createdAt",
         "$updatedAt"
      ],
      "properties":{
         "avatarUrl":{
            "type":"string",
            "format":"url",
            "maxLength":2048
         },
         "avatarHash":{
            "type":"array",
            "maxItems":32,
            "minItems":32,
            "byteArray":true,
            "description":"SHA256 hash of the bytes of the image specified by avatarUrl"
         },
         "displayName":{
            "type":"string",
            "maxLength":25
         },
         "publicMessage":{
            "type":"string",
            "maxLength":140
         },
         "avatarFingerprint":{
            "type":"array",
            "maxItems":8,
            "minItems":8,
            "byteArray":true,
            "description":"dHash the image specified by avatarUrl"
         }
      },
      "additionalProperties":false
   },
   "contactInfo":{
      "indices":[
         {
            "unique":true,
            "properties":[
               {
                  "$ownerId":"asc"
               },
               {
                  "rootEncryptionKeyIndex":"asc"
               },
               {
                  "derivationEncryptionKeyIndex":"asc"
               }
            ]
         },
         {
            "properties":[
               {
                  "$ownerId":"asc"
               },
               {
                  "$updatedAt":"asc"
               }
            ]
         }
      ],
      "required":[
         "$createdAt",
         "$updatedAt",
         "encToUserId",
         "privateData",
         "rootEncryptionKeyIndex",
         "derivationEncryptionKeyIndex"
      ],
      "properties":{
         "encToUserId":{
            "type":"array",
            "maxItems":32,
            "minItems":32,
            "byteArray":true
         },
         "privateData":{
            "type":"array",
            "maxItems":2048,
            "minItems":48,
            "byteArray":true,
            "description":"This is the encrypted values of aliasName + note + displayHidden encoded as an array in cbor"
         },
         "rootEncryptionKeyIndex":{
            "type":"integer",
            "minimum":0
         },
         "derivationEncryptionKeyIndex":{
            "type":"integer",
            "minimum":0
         }
      },
      "additionalProperties":false
   },
   "contactRequest":{
      "indices":[
         {
            "unique":true,
            "properties":[
               {
                  "$ownerId":"asc"
               },
               {
                  "toUserId":"asc"
               },
               {
                  "accountReference":"asc"
               }
            ]
         },
         {
            "properties":[
               {
                  "$ownerId":"asc"
               },
               {
                  "toUserId":"asc"
               }
            ]
         },
         {
            "properties":[
               {
                  "toUserId":"asc"
               },
               {
                  "$createdAt":"asc"
               }
            ]
         },
         {
            "properties":[
               {
                  "$ownerId":"asc"
               },
               {
                  "$createdAt":"asc"
               }
            ]
         }
      ],
      "required":[
         "$createdAt",
         "toUserId",
         "encryptedPublicKey",
         "senderKeyIndex",
         "recipientKeyIndex",
         "accountReference",
         "coreHeightCreatedAt"
      ],
      "properties":{
         "toUserId":{
            "type":"array",
            "maxItems":32,
            "minItems":32,
            "byteArray":true,
            "contentMediaType":"application/x.dash.dpp.identifier"
         },
         "senderKeyIndex":{
            "type":"integer",
            "minimum":0
         },
         "autoAcceptProof":{
            "type":"array",
            "maxItems":102,
            "minItems":38,
            "byteArray":true
         },
         "accountReference":{
            "type":"integer",
            "minimum":0
         },
         "recipientKeyIndex":{
            "type":"integer",
            "minimum":0
         },
         "encryptedPublicKey":{
            "type":"array",
            "maxItems":96,
            "minItems":96,
            "byteArray":true
         },
         "coreHeightCreatedAt":{
            "type":"integer",
            "minimum":1
         },
         "encryptedAccountLabel":{
            "type":"array",
            "maxItems":80,
            "minItems":48,
            "byteArray":true
         }
      },
      "additionalProperties":false
   }
}

Did this page help you?