Contract
The contract library provides functionality for data sharing between different users/organizations. In order for a user to buy/acquire an asset, which can be found in Marketplace, he must first create an ethereum wallet, but only in case he does not belong to an organization or he is the manager of his own organization. During data acquisition process, contract details are stored in platform's blockchain.
Contract Statuses
- Request: The data consumer made a contract request about an asset.
- Declined: The data provider declined the contract request.
- Draft: The data provider accepted the contract request.
- Rejected: One of the two parties rejected the contract at any point.
- Negotiate: One of the two parties made some changes on the contract.
- Signed: One of the two parties accepted the contract.
- Active: The data provider activated the contract after the payment was completed.
- Expired: The contract's duration of use has expired.
Data Acquisition Pipeline
The data acquisition pipeline takes place between two actors, the Provider, the person that owns the original data, and the Consumer the person that wants to buy/acquire the data.
First, the Consumer creates a contract request about the asset he wants to buy/acquire. In the request, he specifies the duration that he wants to use/own the asset, if he wants to use the asset only within the platform or locally (offline retention) and selects which fields (and filters) he wants from the dataset.
Then, the data provider receives that contract request and he can either accept or decline the request. In case of declining the request, the contract takes the Declined
status. Accepting the request, the provider prepares a draft contract by providing payment details (price, currency, vat) for the asset and the contract terms.
The Draft
contract is sent to the consumer, who can either accept, negotiate or reject it. Rejecting the draft contract, the contract takes the Rejected
status. Negotiating the contract, the consumer can change the suggested price and make changes on the contract terms. In this case, the contract takes the Negotiate
status and the updated contract is sent to the data provider. The provider can now see the changed price and contract's terms (all negotiations are tracked) and he can either accept, decline or negotiate again.
This process continues between the two parties until one of them accepts the contract. In that case, the contract takes the Signed
status and when the payment between the two actors is completed, the data provider can activate the contract. The consumer can now download the Active
contract as PDF and use the asset he bought/acquired.
If an asset has public license, then the consumer can directly acquire it, without passing through the above pipeline.
Available Services
sendEthersToWallet
Sends an amount of ethers from platform's ethereum wallet to a specific user's wallet using his ethereum address.
Param | Type | Description |
---|---|---|
ethaddress | string | The ethereum address of the user |
retrieveByUserId
Retrieves contracts that belong to specific users (are either consumers or providers).
Param | Type | Description |
---|---|---|
userIds | number[] | The unique users' ids |
retrieveByAssetId
Retrieves unique contracts' ids using their asset id which have status different than Declined, Rejected and Expired.
Param | Type | Description |
---|---|---|
assetId | number | The unique asset id |
retrieveActivePending
Retrieves unique assets' ids which belong to contracts that have as consumer id one of the user ids given and have status different than Declined, Rejected and Expired.
Param | Type | Description |
---|---|---|
userIds | number[] | The unique users' ids |
retrieveAcquiredAssets
Retrieves assets which belong to contracts that have as consumer id one of the user ids given and have Active status.
Same parameters as the retrieveActivePending service.
retrieveRequestByAssetId
Retrieves a contract which has as asset id the asset id given, as consumer id one of the user ids given and Request status.
Param | Type | Description |
---|---|---|
assetId | number | The unique asset id |
userIds | number[] | The unique users' ids |
retrieveActiveByAssetId
Retrieves a contract which has as asset id the asset id given, as consumer id one of the user ids given and Active status.
Same parameters as the retrieveRequestByAssetId service.
retrieve
Retrieves a contract by its unique id.
Param | Type | Description |
---|---|---|
id | string | The unique contract id |
manager? | any | Optional transaction manager |
create
Creates a contract.
Param | Type | Description |
---|---|---|
data | CreateContractDTO | Contract data |
manager? | any | Optional transaction manager |
update
Updates a contract using its id.
Param | Type | Description |
---|---|---|
id | string | The unique contract id |
data | UpdateContractDTO | Contract data |
manager? | any | Optional transaction manager |
generatePDF
Generates a PDF for the contract given which includes its asset name, its basic information (provider, consumer, effective date, duration of use), its asset details (fields and filters), its payment details (price, currency, vat), its terms and the platform's terms.
Param | Type | Description |
---|---|---|
contract | Contract | The contract |
updateExpiredContracts
Cron job that runs every day at midnight and updates contracts' status from Active to Expired if their duration of use has expired.