Offline mass transfer
Process of preparing a mass transfer offline using a command line tool.
Introduction
The purpose of this process is to sign and distribute a large number of transfers in a secure way without consuming the Minka API or implementing the SDK on the originator side.
All the movements of balances in the Minka Cloud are initiated by messages derived from private keys that are generated at the source. The management of the keys is the responsibility of the source and it is recommended to prepare the mass-transfers offline if you are not using the API interface.
Since all transfers are signed using asymmetric cryptography the signed transfers could be sent using any channel.
The tool also provides a secure way to submit the transfers to protect the information in transit and requires a user login.
Setting up the tool
Introduction
A command line tool is provided to prepare the batch file and the signature. The tool is an npm package and a npm is a package manager for the JavaScript programming language is a prerequisite to execute the tool. About npm:
https://docs.npmjs.com/downloading-and-installing-node-js-and-npm
Install the package
First step is to install the mass-transfer
package on the local computer or server that can be found on https://www.npmjs.com/package/@minka/mass-transfer
Initializing the tool
Generate the initial template files with mass-transfer init
Creating the mass-transfer file templates does not require a login.
Login to remote server
Mass transfer service is a remote server provided by Minka where the file will be uploaded.
You can login to the service using email and password. This command performs a login request and saves a returned token locally in the current directory.
File structure
Transfers
mass-transfer.csv
is a file that contains information about transfers that need to be executed. This is a standard CSV file with columns defined on the first line, the file can contain any number of columns which can be used in order to construct transfers, for example:
Source is the wallet or signer handle
Target represents wallet or signer handle
Amount represents the amount (decimal point)
Template for metadata
transfer.js
serves as a template for building transfers, it allows using any column from the mass-transfer.csv
file in order to generate a new transfer object.
The configuration is a js file so it gives a the flexibility to use the full power of JavaScript, in case the transfers needs to implement some more advanced logic:
The originator can use the standard template file to create transfers, no modification or development is necessary for standard payouts or requests.
Keeper - private keys configuration
keys.json
is a file that should contain the keys used to sign transfers. Those keys should be setup in advance and added to the file before signing transfers.
In the file, addresses are mapped to keys for those signers (address) :
Secret or private key is critical data that should handled with care. Private keys are used to modify balances and should not be shared to the Minka Cloud or any intermediary in the process.
Executing the transfer
Signing the transfers
After everything is in place, a client needs to sign all transfers in the batch with the sign
command
This command will create a new CSV file (mass-transfer-signed.csv
) that will have an additional column called transfer in each row with a signed transfer built from the data of that row:
Submit the file
The last step is to submit this file for processing using the submit
command
Submitting a mass transfer is the first operation that needs to interact with a remote server. Before this call we make sure that you have logged in to the remote server
Get status of a mass transfer
The tool also supports getting statuses of submitted transfers. To get a status summary of a mass transfer use the mass-transfer status
command with the id of a submitted mass transfer:
Request or send transfers are async operations and the status of each transfer depends on the successful completion of the operations on the target side.
Get a report file from the Cloud
A detailed report is also available by using mass-transfer report
command. This commands retrieves a status of each transfer from the original CSV file and returns a similar file that includes a status of each submitted transfer.
Last updated