Link

XZC Staking messages API

Wallet Messages models

Here you can get information about each field in our Wallet Messages API

CreateWalletMessage

field type additional info
externalMessageId String unique message identifier from client (should be unique to portfolio)
portfolioId String unique portfolio identifier for which the message will be created
mainCurrency Currency currency for the wallet
message String message that should be signed

WalletMessage

field type additional info
messageId String unique message identifier
externalMessageId String unique message identifier from client (should be unique for portfolio)
status MessageStatus one of possible message status
portfolioId String unique portfolio identifier for which the message was created
accountId String unique account identifier
mainCurrency Optional<Currency> for deposits and withdrawal. Currency of main blockchain (e.g. may be BTC or ETH for USDT currency)
extra WalletMessageExtra additional wallet message data
createdBy String message creator user ID
organizationId String unique organization identifier
createdAt Long time of message creation

MessageStatus

Enum with possible values (may be changed in future):

status description
working message processing (waiting for client signature)
canceled canceled message
part-signed-tx-added part-signed message was added
full-signed-tx-added fully-signed message was added

WalletMessageExtra

field type additional info
messageRequest MessageRequest data for Vault message signing
partSigned Optional<PartSigned> data for Vault part signed message
signed Optional<FullSigned> data for Vault full signed message

MessageRequest

field type additional info
publicKeyHash String wallet public key hash
currency String wallet currency
message String message that should be signed

PartSigned

field type additional info
uploadBy String user ID
partSignedMessage Object message part signed data

FullSigned

field type additional info
uploadBy String user ID
signedMessage Object object that contains message signature

Get all messages

This retrieves information about all of your messages.

Required permissions: View

Available query string parameters:

parameter type additional info
limit Optional<Int> by default 1000, max 2000
offset Optional<Int> by default 0
+ GET /platform/wallet-messages?limit=1&offset=0

+ Response 200 (application/json)
    {
      "walletMessages": [
        {
          "externalMessageId": "ckf2lcuv4000g3i5uv3x4xn6f",
          "messageId": "11",
          "status": "full-signed-tx-added",
          "portfolioId": "ck8owwcvj000f3j5wrjoyip4d",
          "mainCurrency": "XZC",
          "extra": {
            "messageRequest": {
              "publicKeyHash": "d9f3c6b1066c188aa039e0f4a67dd8b10caf3de3e9c7862a8d0fb17320d57b14",
              "currency": "XZC",
              "message": "tesssss",
              "nonceNumber": "14"
            },
            "partSigned": {
              "uploadBy": "191b5342-2157-4ede-9458-eb673f324468",
              "partSignedMessage": {
                "type": "part-signed-message",
                "value": "eyJjdXJyZW5jeSI6IlhaQyIsIm1lc3NhZ2..."
              }
            },
            "signed": {
              "uploadBy": "d098b47d-5387-4f01-956e-561f15f72f2d",
              "signedMessage": {
                "signature": "IGqvr8lz78p7ZE1eIYkrRL1znpkcxhzhi1peiqoEnEDNKU3i0F5Bct509/dzjkrVeHKtQIl1S8aa82eh2IRG5jI="
              }
            }
          },
          "createdBy": "191b5342-2157-4ede-9458-eb673f324468",
          "organizationId": "PSHENKIN",
          "accountId": "67126cc0-357d-4642-9596-ac0c0bdf4006",
          "createdAt": "1600091821812"
        }
      ],
      "total": "15"
    }

Get message by Id

This retrieves information about a specific message.

Required permissions: View

+ GET /platform/wallet-messages/{messageId}

+ Response 200 (application/json)
  {
      "externalMessageId": "ckf2lcuv4000g3i5uv3x4xn6f",
      "messageId": "11",
      "status": "full-signed-tx-added",
      "portfolioId": "ck8owwcvj000f3j5wrjoyip4d",
      "mainCurrency": "XZC",
      "extra": {
          "messageRequest": {
              "publicKeyHash": "d9f3c6b1066c188aa039e0f4a67dd8b10caf3de3e9c7862a8d0fb17320d57b14",
              "currency": "XZC",
              "message": "tesssss",
              "nonceNumber": "14"
          },
          "partSigned": {
              "uploadBy": "191b5342-2157-4ede-9458-eb673f324468",
              "partSignedMessage": {
                  "type": "part-signed-message",
                  "value": "eyJjdXJyZW5jeSI6IlhaQyIsIm1lc3NhZ2..."
              }
          },
          "signed": {
              "uploadBy": "d098b47d-5387-4f01-956e-561f15f72f2d",
              "signedMessage": {
                  "signature": "IGqvr8lz78p7ZE1eIYkrRL1znpkcxhzhi1peiqoEnEDNKU3i0F5Bct509/dzjkrVeHKtQIl1S8aa82eh2IRG5jI="
              }
          }
      },
      "createdBy": "191b5342-2157-4ede-9458-eb673f324468",
      "organizationId": "PSHENKIN",
      "accountId": "67126cc0-357d-4642-9596-ac0c0bdf4006",
      "createdAt": "1600091821812"
  }

Create message

This creates a new wallet message using sent create wallet message info.

Required permissions: Trading or Withdraw.

+ POST /platform/wallet-messages

+ Request (application/json)
  {
    "externalMessageId": "edef01f1-3442-48e6-89d8-61e0b4342726",
    "mainCurrency": "XZC",
    "portfolioId": "ck8owwcvj000f3j5wrjoyip4d",
    "message": "test"
  }
  
+ Response 201 (application/json)
  {
      "externalMessageId": "edef01f1-3442-48e6-89d8-61e0b4342726",
      "messageId": "23",
      "status": "working",
      "portfolioId": "ck8owwcvj000f3j5wrjoyip4d",
      "mainCurrency": "XZC",
      "extra": {
          "messageRequest": {
              "publicKeyHash": "d9f3c6b1066c188aa039e0f4a67dd8b10caf3de3e9c7862a8d0fb17320d57b14",
              "currency": "XZC",
              "message": "test",
              "nonceNumber": "15"
          }
      },
      "createdBy": "2be6a18a-f57c-43d1-af3b-2a150e5b87c6",
      "organizationId": "PSHENKIN",
      "accountId": "67126cc0-357d-4642-9596-ac0c0bdf4006",
      "createdAt": "1600155071616"
  }

Cancel message

This cancels an message.

Required permissions: Trading or Withdraw.

+ PATCH /platform/wallet-messages/{messageId}

+ Header
  Content-Type: application/vnd.cancel-wallet-message+json

+ Request
  {}

+ Response 200 (application/json)
  {}

Create and sign messages with Copper Unlimited server

  1. Start Copper Unlimited server

    docker run --rm -ti \
      -v ${PWD}/key-backups/:/app/keys/ \
      -p 3010:3010 \
      copperexchange/copper-unlimited:latest
    

    ${PWD}/key-backups/ should contain MPC wallets backup from Copper Unlimited.

  2. Create wallet message

     + POST https://api.copper.co/platform/wallet-messages
        
     + Request
       {
         "externalMessageId": "ckdr8xy1l00303g5neu5iunh4",
         "mainCurrency": "XZC",
         "message": "test",
         "portfolioId": "edd7e0ea-9d00-4538-b187-c14813d7b0ba",  // from account
       } 
          
     + Response 201
     {
       "externalMessageId": "ckfgpkesr000d3j5twa61gzl1",
       "messageId": "24",
       "status": "working",
       "portfolioId": "ck8owwcvj000f3j5wrjoyip4d",
       "mainCurrency": "XZC",
       "extra": {
         "messageRequest": {
           "publicKeyHash": "d9f3c6b1066c188aa039e0f4a67dd8b10caf3de3e9c7862a8d0fb17320d57b14",
           "currency": "XZC",
           "mainCurrency": "XZC",
           "message": "test",
           "nonceNumber": "16"
         }
       },
       "createdBy": "191b5342-2157-4ede-9458-eb673f324468",
       "organizationId": "PSHENKIN",
       "accountId": "67126cc0-357d-4642-9596-ac0c0bdf4006",
       "createdAt": "1600945419113"
     }
    
  3. Sign message in offline copper-unlimited-server

    + POST http://127.0.0.1:3010/signatures
       
    + Headers
      Content-Type: application/json
    
    + Request
      {
        "type": "message-request",
        "keyPassword": "myTestPaswordFromKeyBackup.1234#",
        "keyFilename": "XZC_My Default Vault_wallet.copper",
       
       
         // get all this fields from message.extra.messageRequest, described above
        "signRequest": {
         "publicKeyHash": "d9f3c6b1066c188aa039e0f4a67dd8b10caf3de3e9c7862a8d0fb17320d57b14",
         "currency": "XZC",
         "mainCurrency": "XZC",
         "message": "test",
         "nonceNumber": "16"
       }
      }
       
    + Response 200 OK
      {
        "type": "part-signed-message",
        "value": "AQRwL5FqGrbLaPO4w+NoEq9oZ...R5I/wjEQND/4YmIn+rbN9uh5U/0=",
      }
    
  4. Upload part-signed message to Copper

     + PATCH https://api.copper.co/platform/wallet-messages/{walletMessageId}
        
     + Headers
       Content-Type: application/vnd.upload-part-signed-wallet-message+json
          
     + Request
       {
         "partSignedMessage": {
           "type": "part-signed-tx",
           "value": "AQRwL5FqGrbLaPO4w+NoEq9oZ...R5I/wjEQND/4YmIn+rbN9uh5U/0="
         }
       }