8000 GitHub - redhio/ced-capstone: Certified Ethereum Capstone Project. This is our CED Capstone project submission for Blockchainhub Certified Ethereum Developer. This project implments a blockchain utility service for machine learning.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Certified Ethereum Capstone Project. This is our CED Capstone project submission for Blockchainhub Certified Ethereum Developer. This project implments a blockchain utility service for machine learning.

License

Notifications You must be signed in to change notification settings

redhio/ced-capstone

Repository files navigation

ced-capstone

This submission is on behalf of team "redhio" consisting of github users: redhio-don, egmeek and robynph.

This project is to show how an external remote service can be governed by blockchain smart contracts. A series of service and state contracts govern the interactions, while a remote service bridge initiates the remote service and returns the results to the smart contract.

The highlevel steps for our entire process are as follows;

  1. Receive data from a web3 interface

  2. Send data to a smart contract

  3. Contract captures data and runs BigML javascript file

  4. BigML model runs on BigML website (https://bigml.com/) and returns result to contract

  5. Contract processes payment and stores result for audit trail

Iris Prediction using BigML

The service that is used in this test is a simple well know exmaple machine learning model, which predicts the type of IRIS flower based on three input parameters. The details can be found https://bigml.com/api

inputs: petal length, petal width, sepal length

outputs: a prediction

Requirements

This Dapp requires Parity with signer enabled or Metamask.

Using the contracts

There are 2 contracts; contract "purchase" in file RemoteServicePurchase.sol and contract "MLPurchase" in file MLPurchaseTest.sol.

RemoteServicePurchase.sol

Summary

This contract governs the transaction for a remote machine learning service. * The three entities which interact with the contract are the buyer, seller, and the external remote services. * For a Utility model, we would like this to be like a Pre-Authorized-Debit (PAD), but for now you have to send eth.

Steps to complete "Purchase" contract

Link to contract walkthrough;

Details:

  1. Publish RemoteServiceContract with contract rate and machine learning model ID. This calls the constructor. Create and sign the request. Wait for the contract to be mined, then retrieve the contract address.

  2. Execute the confirmPurchase and agree to the contract terms and price. Sign the transaction.

  3. Can check the account on Etherscan to see the contract was deployed and the corresponding transaction information.

  4. Execute the Predict function and enter the ML Model parameters. For this example enter the petal length, width, and sepal length. Also send the amount of Wei specified by contractRate (2 Wei)

  5. Execute the confirmReceived function. Confirm the purchase was received by signing two transactions. The funds will be transferred and the state of the contract changed to 2. completed.

  6. Can check the account on Etherscan to see the contract was executed and the corresponding transaction information.

MLPurchaseTest.sol

Summary

MLPurchase is a contract used to receive a request from a customer to run data against an ML (machine learning) model. It receives the modelID, customerID, contractSLA, contractRate and seller address from a web3 interface to initiate the contract.

Upon deployment, the reportData function would provide details to a web3 interface which would send the request to an ML model (in this example we are using BigML). The ML model would process the request and respond back to the MLPurchaseEnd function with an accuracy value, verification ID and contract value. The reported accuracy is tested against the contractSLA and the verification ID is tested against the customer ID to ensure this result is matched to the correct contact (using custID in this example for simplicity, the verifyID would be more complicated in practice.)

If the verify ID and customer ID match, the MLPurchaseEnd function releases the funds. If not, the contract reverts.

Steps to complete "MLPurchase" contract

Link to contract walkthrough;

Details:

  1. Enter contractRate (in wei), contract SLA, customer ID, model ID and seller address into Remix console.

  2. Create contract and send using MetaMask – active account is considered the customer or “buyer”. Contract is deployed.

  3. Can check the account on Etherscan to see the contract was deployed and the corresponding transaction information.

  4. Can use the report function to see the data posted to the contract. This information would also be sent to the ML model using a web3 interface.

  5. Can see seller address was captured but the verifyID and MlAcc values have not been passed yet.

  6. Complete the purchase by populating the MLPurchaseEnd prompt with the verifyID and MLAcc values. For this example verifyID is custID. Also, the amount of wei sent should match the ContractRate. Validation ensure the correct amount is entered into contract.

  7. Purchase is complete. Can see the value was sent to the seller’s account on Etherscan and the MLAcc and VerifyID have been stored in the contract.

About

Certified Ethereum Capstone Project. This is our CED Capstone project submission for Blockchainhub Certified Ethereum Developer. This project implments a blockchain utility service for machine learning.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages

0