GraphGrail Ai Presents Its Smart Contract

in #bitcoin7 years ago


The GraphGrail Ai project has posted its smart contract structure on GitHub. The smart contracts are designed to provide markup placement on the blockchain. When developing the smart contract, the developers were faced with a multitude of difficulties, such as the complexity of relations on the platform and the presence of limiting factors.

When developing the principle of the smart contract’s functioning, the developers were faced with the task of writing an escrow smart contract. The difficulties lay in the manner of interaction between the smart contract and the client. For instance, there is a client that could pay the data markers directly, but the platform first has to make sure that the latter has money and has work to offer. Within the framework of existing smart contracts, the client would not be able to get a refund without a commission.

Here is an overview of how our data labeling mechanism works.

Work with the data-tagger bot includes the following steps:

  1. Placement of an order for markup (the customer is authorized in his account, writes a specific task);

  2. Distribution of tasks to the platform residents (at this stage, the executors are defined who will be given tasks in chunks (for example, 20 or 100 texts for markup);

  3. Writing up of data to smart contracts for Ethereum for transparency of the markup procedure;

  4. Checks of the conditions for executing the smart contract in cases when the job is done well, and when not, and closing (finalizing) the smart contract with the payment of tokens for work;

  5. Transfer of the finished work to the customer.

In this post we describe in details how our Escrow smart-contract handle data.

Nominally, it is deemed that clients have good intentions. However, any contract on the GraphGrail Ai platform has three sides, including the client, the markup creator and GraphGrail Ai. The smart contract protects the markup creator and does not allow the possibility of diminishing the results of successfully fulfilled tasks. Only remuneration increasing changes can be introduced in the parameters of work fulfilled. The client is obliged to issue a decision on the work fulfilled by the markup creator. A smart contract gives the client time to decide whether they are satisfied with the quality of the work performed by the markup creator. The grace period is limited to two days. If the client has not expressed disapproval, then the markup creator receives their fee. If the client is not satisfied with the work, they will still pay a commission.

In the future, GraphGrail Ai plans to introduce a “level of trust” system when both the client and the markup creator will be able to choose only the “trusted” platform participants who have already signed and executed at least one escrow contract. If the work is not performed or is done on a sub-par level, the markup creator will lose reputation, but this is a question for more detailed analysis based on each individual situation. A smart contract allows platform participants to pay for the work done to those who have received tasks, as it is impossible to replace payment wallets.

The smart contract also includes a new instrument called Force finalize. Force finalize confirms all works that are waiting for confirmation and transfers money for works to the markup creator, while excess funds that remain on the smart contract are returned to the client. Force finalize cannot be called upon in any situation as it is a selective instrument.

Suppose a scenario in which the client has stopped placing new tasks, but has money that they wish to spend, while they have already paid for all the works done for them. In this case, Force finalize can only be called upon by the client, because all the work is already paid for. There is no work to be done, and there is still money on the smart contract. A smart contract itself cannot initiate a Force finalize action.

A smart contract cannot guarantee that the client will provide more work, the cost of which is not originally included in the smart contract. However, it is impossible to confirm the existence of excess work performed if the smart contract does not include a stipulated fee for it. GraphGrail Ai has conducted many tests with its smart contract to make sure that it is sufficiently protected from attacks.

The conclusion that can be drawn from the development of such a smart contract by GraphGrail Ai and the introduction of such parameters is that such an approach will be beneficial for all parties involved. By providing transparency and escrow functions, the platform ensures full integrity of all parties to the smart contract and guarantees the profitability of the platform.

As a result of the implementation of such smart contracts on the GraphGrail Ai platform, markup creators can safely tag data, create AI solutions for businesses and create new platform components, knowing that their efforts will be rewarded in accordance with the quality of their works and their reputation. At the same time, business clients on the platform will be able to order and use platform solutions in their business, and sell access to neural networks.

The main contract on the GraphGrail Ai platform is the escrow Smart Contract https://github.com/GraphGrail/smart-contracts/blob/master/truffle/contracts/GGProject.sol

Read more about code related to different use-cases regarding items and work approval, you could check implementations yourself.

The debug version of the smart contract is the following https://github.com/GraphGrail/smart-contracts/blob/master/truffle/contracts/GGProjectDebug.sol

The following is a compiled contract https://github.com/GraphGrail/smart-contracts/blob/master/truffle/build/contracts/GGProject.json

local-dev-net — here for local tests the code

The project contains code of GraphGrail data labelling escrow smart contract and its test suite.
Smart contract is written in Solidity v. 0.4.17. JavaScript helpers and a test suite use Truffle v. 4.1.3.

To run tests and backend server geth v. 1.8.2 or later is required. It also should work with latest Parity.

The Repository contains smart contract code and utils for build and deployment, tests written with Truffle, data and scripts for running local geth in development mode for testing purposes, and JavaScript code for interaction with smart contract.

Truffle is a folder with truffle development environment. Escrow smart contract code resides in truffle/contracts/GGProject.sol, truffle/migrations folder contains code for smart contract deployment, truffle/test is where all the tests are.

local-dev-net is the folder with scripts and seed data required for running local geth in development mode.

ethereum-bridge folder contains JavaScript code of client and server for interacting with GraphGrail escrow and token smart contracts: ethereum-bridge/client contains code of frontend library, and ethereum-bridge/server contains implementation of Node.js backend server providing REST API. Some code is shared between frontend, backend and smart contract tests; it resides in ethereum-bridge/shared subdirectory.

Development setup

Prior to developing or running tests, it is necessary to install the dependencies:
cd <project-root>
./install-deps.sh

A frontend library is built with webpack. To start development server, run npm start command in ethereum-bridge/clientfolder. To build a production version of the library, run npm run build in the same folder and check the ethereum-bridge/client/build folder for results.

Running tests with TestRPC

The GraphGrail Ai escrow smart contract has a test suite. To run it against the TestRPC virtual blockchain just run npm test:
cd ./truffle
npm test

Running tests against local geth node

To run a test suite against a real Ethereum node, first run local geth in dev mode:
cd ./local-dev-net
./run-geth.sh

This will set up a local testing Ethereum network and populate it with seed accounts and balances specified in the blockchain dump ./local-dev-net/blockchain.tar.gz. After having successfully running geth node, run npm test-local:
cd ./truffle
npm run test-local

Follow our news and updates and also take part in our TGE!

Coin Marketplace

STEEM 0.22
TRX 0.20
JST 0.034
BTC 91713.09
ETH 3128.30
USDT 1.00
SBD 3.18