-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- create all necessary parties - create, issue certificates
- Loading branch information
Showing
41 changed files
with
2,040 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"directory": "./bower_components" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
logs/* | ||
!.gitkeep | ||
node_modules/ | ||
bower_components/ | ||
tmp | ||
.DS_Store | ||
.idea | ||
environments/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"globalstrict": true, | ||
"globals": { | ||
"angular": false, | ||
"describe": false, | ||
"it": false, | ||
"expect": false, | ||
"beforeEach": false, | ||
"afterEach": false, | ||
"module": false, | ||
"inject": false | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
language: node_js | ||
node_js: | ||
- "0.10" | ||
|
||
before_script: | ||
- export DISPLAY=:99.0 | ||
- sh -e /etc/init.d/xvfb start | ||
- npm start > /dev/null & | ||
- npm run update-webdriver | ||
- sleep 1 # give server time to start | ||
|
||
script: | ||
- node_modules/.bin/karma start karma.conf.js --no-auto-watch --single-run --reporters=dots --browsers=Firefox | ||
- node_modules/.bin/protractor e2e-tests/protractor.conf.js --browser=firefox |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
The MIT License | ||
|
||
Copyright (c) 2010-2014 Google, Inc. http://angularjs.org | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,113 @@ | ||
# KimberlyProcessEthereum | ||
An implementation of The Kimberley Process built on Ethereum | ||
An implementation of The Kimberley Process's certificate issuance and validation system built on the Ethereum blockchain. | ||
|
||
--- | ||
|
||
__My complete thoughts on diamonds, the diamond industry and The Kimberley Process are available here:__ | ||
[http://romancingthestones.diamonds](http://romancingthestones.diamonds) | ||
|
||
--- | ||
|
||
##About | ||
|
||
[The Kimberley Process](http://www.kimberleyprocess.com) (KP) is a joint government, industry and civil society initiative to stem the flow of conflict diamonds – rough diamonds used by rebel movements to finance wars against legitimate governments. | ||
|
||
Implementation of the KP (including definitions) is outlined in the [KPCS Core Document](http://www.kimberleyprocess.com/en/kpcs-core-document). | ||
|
||
In order to bring both transparency and integrity to the KP, my proposal is to put the entirety of the certificate issuance process, including all participants, authorities, observers, agents and parties, on the Ethereum blockchain. The specific features of the blockchain (mathematically-enforced security, immutability, public availability of data) would be a dramatic improvement over the current system of paper certificates and their known weaknesses, such as susceptibility to forgery, varying certificate security features, and overly-generous expiration dates (and therefore the possibility of re-use). | ||
|
||
--- | ||
|
||
##Definitions | ||
|
||
###Participant | ||
Member countries that are participants in The Kimberley Process. | ||
[Here is a current list of participant countries](http://www.kimberleyprocess.com/en/participants) | ||
|
||
###Particpant Authority | ||
An authority designated by the Particpant with the power to issue certificates. For example, the Ministry of Mines and Mineral Resources (Sierra Leone). These authorities do not issue certificates directly, but rather delegate those powers to specific employees, or agents. | ||
|
||
###Participant Agent | ||
An individual designated by a Participant Authority with the power to issue certificates. | ||
|
||
###Party | ||
An entity or individual acting as either the source or destination of the shipment of rough diamonds over international borders. | ||
|
||
--- | ||
|
||
##Certificate issuance process: | ||
|
||
###1. A certificate is created by the exporting party, with references to: | ||
- the importing party we are sending the shipment to | ||
- the source participant | ||
- the destination participant | ||
|
||
```solidity | ||
//Certificate.sol: | ||
function Certificate(address _exporter, | ||
address _importer, | ||
address _participantSource, | ||
address _participantDestination) { | ||
... | ||
} | ||
``` | ||
|
||
Each certificate contains the following data: | ||
|
||
1. Participants | ||
- _Origins:_ geological origins where goods were mined from. _Note: This value is not set directly, but is derived from the origins of the parsels._ | ||
- _Source:_ participant country the shipment is being sent from. | ||
- _Destination:_ participant country the shipment is being sent to. | ||
|
||
2. Agents | ||
- _Exporting:_ agent delegated by source participant's exporting authority the power to sign certificates. | ||
- _Importing:_ agent delegated by destination participant's importing authority the power to sign certificates. | ||
|
||
3. Parties | ||
- _Exporting:_ entity or individual goods are being sent from | ||
- _Importing:_ entity or individual goods are being sent to | ||
|
||
4. Parsels | ||
- An array consisting of parsels of goods included in the shipment. Data includes: | ||
- carats | ||
- value | ||
- geological origins | ||
|
||
###2. Parsels are added to the certificate: | ||
```solidity | ||
//Certificate.sol | ||
function addParsel(uint carats, | ||
uint value, | ||
address[] origins) { | ||
... | ||
} | ||
``` | ||
Each parsel contains: | ||
- Carats | ||
- Assessed value | ||
- Addresses of participant countries of geological origins | ||
|
||
###3. Signatures required from: | ||
1. Importing party | ||
2. Exporting authority agent | ||
3. Importing authority agent | ||
|
||
```solidity | ||
//Certificate.sol | ||
function sign() { | ||
... | ||
} | ||
``` | ||
|
||
Upon receipt of the last required signature (order is unimportant), the certificate is issued and shipment is cleared for transit. | ||
|
||
###4. Importing authority marks shipment as received: | ||
|
||
```solidity | ||
//Certificate.sol: | ||
function markAsReceived() { | ||
... | ||
} | ||
``` | ||
|
||
Upon acknowleged receipt of the shipment, the importing authority marks the certificate as received, completing the certificate. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
(function() { | ||
'use strict'; | ||
|
||
angular.module('kpcs', [ | ||
'ngRoute', | ||
'rzModule', | ||
'oitozero.ngSweetAlert', | ||
'angularMoment' | ||
]). | ||
config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider) { | ||
$routeProvider.otherwise({redirectTo: '/'}); | ||
$locationProvider.html5Mode(true); | ||
}]); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
(function() { | ||
'use strict'; | ||
|
||
angular.module('kpcs').service('ethereum', ethereum); | ||
|
||
/* @ngInject */ | ||
function ethereum() { | ||
var service = { | ||
web3: new Web3(), | ||
isConnected: isConnected | ||
}; | ||
|
||
activate(); | ||
|
||
return service; | ||
|
||
/////////////////// | ||
|
||
function activate() { | ||
service.web3.setProvider(new service.web3.providers.HttpProvider("http://localhost:8545")); | ||
} | ||
|
||
function isConnected() { | ||
return service.web3.currentProvider.isConnected(); | ||
} | ||
} | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>MetaCoin - Default Truffle App</title> | ||
<link href='https://fonts.googleapis.com/css?family=Open+Sans:400,700' rel='stylesheet' type='text/css'> | ||
<link href="./app.css" rel='stylesheet' type='text/css'> | ||
<script src="./app.js"></script> | ||
</head> | ||
<body> | ||
<h1>MetaCoin</h1> | ||
<h2>Example Truffle Dapp</h2> | ||
<h3>You have <span class="black"><span id="balance"></span> META</span></h3> | ||
|
||
<br> | ||
<h1>Send</h1> | ||
<br><label for="amount">Amount:</label><input type="text" id="amount" placeholder="e.g., 95"></input> | ||
<br><label for="receiver">To Address:</label><input type="text" id="receiver" placeholder="e.g., 0x93e66d9baea28c17d9fc393b53e3fbdd76899dae"></input> | ||
<br><br><button id="send" onclick="sendCoin()">Send MetaCoin</button> | ||
<br><br> | ||
<span id="status"></span> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
var accounts; | ||
var account; | ||
var balance; | ||
|
||
function setStatus(message) { | ||
var status = document.getElementById("status"); | ||
status.innerHTML = message; | ||
}; | ||
|
||
function refreshBalance() { | ||
var meta = MetaCoin.deployed(); | ||
|
||
meta.getBalance.call(account, {from: account}).then(function(value) { | ||
var balance_element = document.getElementById("balance"); | ||
balance_element.innerHTML = value.valueOf(); | ||
}).catch(function(e) { | ||
console.log(e); | ||
setStatus("Error getting balance; see log."); | ||
}); | ||
}; | ||
|
||
function sendCoin() { | ||
var meta = MetaCoin.deployed(); | ||
|
||
var amount = parseInt(document.getElementById("amount").value); | ||
var receiver = document.getElementById("receiver").value; | ||
|
||
setStatus("Initiating transaction... (please wait)"); | ||
|
||
meta.sendCoin(receiver, amount, {from: account}).then(function() { | ||
setStatus("Transaction complete!"); | ||
refreshBalance(); | ||
}).catch(function(e) { | ||
console.log(e); | ||
setStatus("Error sending coin; see log."); | ||
}); | ||
}; | ||
|
||
window.onload = function() { | ||
web3.eth.getAccounts(function(err, accs) { | ||
if (err != null) { | ||
alert("There was an error fetching your accounts."); | ||
return; | ||
} | ||
|
||
if (accs.length == 0) { | ||
alert("Couldn't get any accounts! Make sure your Ethereum client is configured correctly."); | ||
return; | ||
} | ||
|
||
accounts = accs; | ||
account = accounts[0]; | ||
|
||
refreshBalance(); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
body { | ||
margin-left: 25%; | ||
margin-right: 25%; | ||
margin-top: 10%; | ||
font-family: "Open Sans", sans-serif; | ||
} | ||
|
||
label { | ||
display: inline-block; | ||
width: 100px; | ||
} | ||
|
||
input { | ||
width: 500px; | ||
padding: 5px; | ||
font-size: 16px; | ||
} | ||
|
||
button { | ||
font-size: 16px; | ||
padding: 5px; | ||
} | ||
|
||
h1, h2 { | ||
display: inline-block; | ||
vertical-align: middle; | ||
margin-top: 0px; | ||
margin-bottom: 10px; | ||
} | ||
|
||
h2 { | ||
color: #AAA; | ||
font-size: 32px; | ||
} | ||
|
||
h3 { | ||
font-weight: normal; | ||
color: #AAA; | ||
font-size: 24px; | ||
} | ||
|
||
.black { | ||
color: black; | ||
} | ||
|
||
#balance { | ||
color: black; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"name": "kpcs", | ||
"description": "A simple Ethereum dapp that allows accounts to contribute ether to be redistributed using a weighted random selection.", | ||
"version": "0.0.0", | ||
"license": "MIT", | ||
"private": true, | ||
"dependencies": { | ||
"angular-route": "~1.4.0", | ||
"angular-loader": "~1.4.0", | ||
"html5-boilerplate": "~5.2.0", | ||
"angular-bootstrap": "~1.2.4", | ||
"web3": "~0.15.3", | ||
"angularjs-slider": "~2.10.2", | ||
"Chart.js": "~1.0.2", | ||
"moment": "~2.12.0", | ||
"ngSweetAlert": "angular-sweetalert#~1.1.0", | ||
"angular-moment": "~0.10.3" | ||
}, | ||
"ignoredDependencies": [ | ||
"angular" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import {User} from "./User.sol"; | ||
|
||
contract Administrator is User("name", 0x0) { | ||
function Administrator(string _name, address _administrator) { | ||
name = _name; | ||
owner = msg.sender; | ||
administrator = _administrator; | ||
} | ||
|
||
function getType() returns (int) { | ||
return -1; | ||
} | ||
} |
Oops, something went wrong.