Sign Contract Batch

API Endpoint

http://127.0.0.1:5001/api/v1/storage/upload/signcontractbatch?

Input Parameters

Argument

Required?

Type

Description

Required?

session-id

Y

string

ID for the storage upload session.

Y

peer-id

N

string

Client that requires the offline signs

N

nonce-timestamp

Y

int64

Timestamp used for nonce. Must be within 1 hour of server time.

N

upload-session-signature

Y

string

Private key-signed string of “::” for this delegated request.

N

session-status

Y

string

The “status” API session status that is received right before calling this API.

N

signed-data-items

Y

string

Result of offline signing of the Contracts. This is an array of json marshalled Contract which is defined at the Response of getcontractbatch API.
But Contract.ContractData has signed data bytes in string format.

N

Usage

// Usage

signbatch, err = s.StorageUploadSignBatch(sessionId, mhash, c, uts, storage.Status)


// Go Wrapper

func (s *Shell) StorageUploadSignBatch(sid string, hash string, unsignedBatchContracts *Contracts, uts string, sessionStatus string) error {
    var signedBatchContracts *Contracts
    var errSign error
    offlinePeerSessionSignature, err := getSessionSignature()
    if err != nil {
        return err
    }

    signedBatchContracts, errSign = unsignedBatchContracts.SignContracts(utils.GetPrivateKey(), sessionStatus)
    if errSign != nil {
        return err
    }
    bytesSignBatch, err := json.Marshal(signedBatchContracts.Contracts)
    if err != nil {
        return err
    }

    rb := s.Request("storage/upload/signcontractbatch", sid, utils.GetPeerId(), uts, offlinePeerSessionSignature,
        sessionStatus, string(bytesSignBatch))
    return rb.Exec(context.Background(), nil)
}
curl -X POST http://127.0.0.1:5001/api/v1/storage/upload/getunsigned?arg=647cae8b-7da1-4e00-b183-e34a1517d15e&arg=16Uiu2HAm5KyUqXm7gZb5ECj4vDWVVjVuzNoj7cNM3Q7Eoz5Vsj2D&arg=1582848820&arg=16Uiu2HAm5KyUqXm7gZb5ECj4vDWVVjVuzNoj7cNM3Q7Eoz5Vsj2D%3AQmQqiYA6LXehPbMw5UtW3zCWstEZ9mY37QNxss41SspAzG%3Atime.Now%28%29.String%28%29&arg=balanceSignReady

Response

{
}