ProofOfPhone at Oracles
This commit is contained in:
parent
2d1829f31e
commit
6bf5eeacaf
17
web/app.js
17
web/app.js
|
@ -5,25 +5,19 @@ var twilio = require('twilio');
|
||||||
var mongodb = require('mongodb');
|
var mongodb = require('mongodb');
|
||||||
var bodyParser = require('body-parser');
|
var bodyParser = require('body-parser');
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
var Web3 = require('web3');
|
|
||||||
var crypto = require('crypto');
|
var crypto = require('crypto');
|
||||||
|
var Web3 = require('web3');
|
||||||
|
|
||||||
var config = JSON.parse(fs.readFileSync('./config.json', 'utf8'));
|
var config = JSON.parse(fs.readFileSync('./config.json', 'utf8'));
|
||||||
|
|
||||||
var twilioClient = twilio(config.sendSMS.twilio.accountSIDLive, config.sendSMS.twilio.authTokenLive);
|
var twilioClient = twilio(config.sendSMS.twilio.accountSIDLive, config.sendSMS.twilio.authTokenLive);
|
||||||
var MongoClient = mongodb.MongoClient;
|
var MongoClient = mongodb.MongoClient;
|
||||||
|
|
||||||
var provider = require('./helpers/basicauthhttpprovider');
|
|
||||||
|
|
||||||
var web3;
|
var web3;
|
||||||
if (typeof web3 !== 'undefined') {
|
if (typeof web3 !== 'undefined') {
|
||||||
web3 = new Web3(web3.currentProvider);
|
web3 = new Web3(web3.currentProvider);
|
||||||
} else {
|
} else {
|
||||||
if (config.environment == "live") {
|
web3 = new Web3(new Web3.providers.HttpProvider(config.Ethereum[config.environment].rpc));
|
||||||
web3 = new Web3(new provider(config.smartContract.rpc[config.environment], config.smartContract.rpc.user, config.smartContract.rpc.pass));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
web3 = new Web3(new Web3.providers.HttpProvider(config.smartContract.rpc[config.environment]));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = '0';
|
process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = '0';
|
||||||
|
@ -38,10 +32,6 @@ app.bodyParser = bodyParser;
|
||||||
app.twilioClient = twilioClient;
|
app.twilioClient = twilioClient;
|
||||||
app.web3 = web3;
|
app.web3 = web3;
|
||||||
app.crypto = crypto;
|
app.crypto = crypto;
|
||||||
|
|
||||||
app.contractAddress = config.smartContract.contractAddress[config.environment];
|
|
||||||
app.contractWallet = config.smartContract.wallet[config.environment];
|
|
||||||
|
|
||||||
app.MongoClient = MongoClient;
|
app.MongoClient = MongoClient;
|
||||||
|
|
||||||
function errorHandler(err, req, res, next) {
|
function errorHandler(err, req, res, next) {
|
||||||
|
@ -69,9 +59,8 @@ app.use(express.static(__dirname + '/public'));
|
||||||
app.set('view engine', 'pug');
|
app.set('view engine', 'pug');
|
||||||
|
|
||||||
require('./helpers/commonHelper')(app);
|
require('./helpers/commonHelper')(app);
|
||||||
require('./helpers/etherHelper')(app);
|
|
||||||
require('./controllers/index')(app);
|
require('./controllers/index')(app);
|
||||||
|
|
||||||
app.listen(app.get('port'), function () {
|
app.listen(app.get('port'), function () {
|
||||||
console.log('Node app is running on port', app.get('port'));
|
console.log('ProofOfPhone is running on port', app.get('port'));
|
||||||
});
|
});
|
|
@ -3,35 +3,21 @@ module.exports = function (app) {
|
||||||
var MongoClient = app.MongoClient;
|
var MongoClient = app.MongoClient;
|
||||||
var mongodbConnectionString = app.config.mongodbConnectionString;
|
var mongodbConnectionString = app.config.mongodbConnectionString;
|
||||||
var randomInt = app.randomInt;
|
var randomInt = app.randomInt;
|
||||||
var attachToContract = app.attachToContract;
|
|
||||||
var generateError = app.generateError;
|
var generateError = app.generateError;
|
||||||
|
var web3 = app.web3;
|
||||||
|
|
||||||
app.get('/', function(request, response) {
|
app.get('/', function(request, response) {
|
||||||
attachToContract(function(err, contract) {
|
response.render("index");
|
||||||
if (err) {
|
|
||||||
console.log(err);
|
|
||||||
response.render("index", {
|
|
||||||
address: app.contractAddress
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
response.render("index", {
|
|
||||||
address: app.contractAddress
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
app.post('/sendCodeBySMS', function(request, response) {
|
app.post('/sendCodeBySMS', function(request, response) {
|
||||||
console.log(request.body);
|
console.log(request.body);
|
||||||
var globalToken = request.body.globalToken;
|
var globalToken = request.body.globalToken;
|
||||||
if (globalToken != app.config.globalToken) {
|
if (globalToken != app.config.globalToken) return generateError(response, 401, "Unauthorized", "Wrong app token");
|
||||||
generateError(response, 401, "Unauthorized", "Wrong app token");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var to = request.body.to;
|
var to = request.body.to;
|
||||||
var code = randomInt(100000,1000000);
|
var code = randomInt(100000,1000000);
|
||||||
|
console.log("code:" + code);
|
||||||
twilioClient.messages.create({
|
twilioClient.messages.create({
|
||||||
body: code,
|
body: code,
|
||||||
to: "+" + to,
|
to: "+" + to,
|
||||||
|
@ -39,101 +25,21 @@ module.exports = function (app) {
|
||||||
}, function(err, message) {
|
}, function(err, message) {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
generateError(response, 500, "Can't send sms", err.message);
|
return generateError(response, 500, "Can't send sms", err.message);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("message.sid: " + message.sid);
|
console.log("message.sid: " + message.sid);
|
||||||
insertSentCodeToDB(to, code, function(err) {
|
var token = "0x" + web3.sha3(code.toString());
|
||||||
if (err) {
|
|
||||||
console.log(err);
|
|
||||||
generateError(response, 500, "Can't insert code to db", err.message);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log("sms code:" + code);
|
console.log("sms code:" + code);
|
||||||
response.send({
|
response.send({
|
||||||
success : {
|
success : {
|
||||||
code : 200,
|
code : 200,
|
||||||
title : "Success",
|
title : "Success",
|
||||||
message : "SMS successfully sent"
|
message : "SMS successfully sent",
|
||||||
|
token: token
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
function insertSentCodeToDB(phone, code, cb) {
|
|
||||||
MongoClient.connect(mongodbConnectionString, function(err, db) {
|
|
||||||
if(err) return cb(err);
|
|
||||||
|
|
||||||
var collection = db.collection('PhoneCodes');
|
|
||||||
collection.remove({phone: phone}, function(err, result) {
|
|
||||||
if (err) {
|
|
||||||
db.close();
|
|
||||||
return cb(err);
|
|
||||||
}
|
|
||||||
|
|
||||||
collection.insert({phone: phone, code: code}, function(err, docs) {
|
|
||||||
db.close();
|
|
||||||
if (err) return cb(err);
|
|
||||||
cb(null);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
app.post("/verifyCodeFromSMS", function(request, response) {
|
|
||||||
console.log(request.body);
|
|
||||||
var globalToken = request.body.globalToken;
|
|
||||||
var code = request.body.code;
|
|
||||||
var phone = request.body.phone;
|
|
||||||
if (globalToken != app.config.globalToken) {
|
|
||||||
generateError(response, 401, "Unauthorized", "Wrong app token");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
MongoClient.connect(mongodbConnectionString, function(err, db) {
|
|
||||||
if (err) {
|
|
||||||
generateError(response, 500, "Error", err.message);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var collection = db.collection('PhoneCodes');
|
|
||||||
collection.find({"code": parseInt(code), "phone": phone }, function(err, cursor) {
|
|
||||||
if (err) {
|
|
||||||
console.log(err);
|
|
||||||
generateError(response, 500, "Error", "Wrong code");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
cursor.toArray(function(err, results) {
|
|
||||||
console.log(err);
|
|
||||||
if (!results) {
|
|
||||||
generateError(response, 500, "Error", "Wrong code");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (results.length == 0) {
|
|
||||||
generateError(response, 500, "Error", "Wrong code");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var hash = app.crypto.createHmac('sha256', app.config.salt)
|
|
||||||
.update(code)
|
|
||||||
.digest('hex');
|
|
||||||
console.log(hash);
|
|
||||||
console.log(results);
|
|
||||||
var result = results[0];
|
|
||||||
response.send({
|
|
||||||
success : {
|
|
||||||
code : 200,
|
|
||||||
message: hash
|
|
||||||
}
|
|
||||||
});
|
|
||||||
db.close();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
|
@ -1,146 +0,0 @@
|
||||||
/*
|
|
||||||
This file is part of web3.js.
|
|
||||||
|
|
||||||
web3.js is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
web3.js is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
/** @file httpprovider.js
|
|
||||||
* @authors:
|
|
||||||
* Marek Kotewicz <marek@ethdev.com>
|
|
||||||
* Marian Oancea <marian@ethdev.com>
|
|
||||||
* Fabian Vogelsteller <fabian@ethdev.com>
|
|
||||||
* @date 2015
|
|
||||||
*/
|
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
var errors = require('web3/lib/web3/errors');
|
|
||||||
|
|
||||||
// workaround to use httpprovider in different envs
|
|
||||||
var XMLHttpRequest; // jshint ignore: line
|
|
||||||
|
|
||||||
// browser
|
|
||||||
if (typeof window !== 'undefined' && window.XMLHttpRequest) {
|
|
||||||
XMLHttpRequest = window.XMLHttpRequest; // jshint ignore: line
|
|
||||||
|
|
||||||
// node
|
|
||||||
} else {
|
|
||||||
XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest; // jshint ignore: line
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* HttpProvider should be used to send rpc calls over http
|
|
||||||
*/
|
|
||||||
var HttpProvider = function (host, user, pass) {
|
|
||||||
this.host = host || 'http://localhost:8545';
|
|
||||||
this.authorizationHeader = 'Basic ' + (new Buffer(user + ':' + pass)).toString('base64');
|
|
||||||
this.user = user;
|
|
||||||
this.pass = pass;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Should be called to prepare new XMLHttpRequest
|
|
||||||
*
|
|
||||||
* @method prepareRequest
|
|
||||||
* @param {Boolean} true if request should be async
|
|
||||||
* @return {XMLHttpRequest} object
|
|
||||||
*/
|
|
||||||
HttpProvider.prototype.prepareRequest = function (async) {
|
|
||||||
var request = new XMLHttpRequest();
|
|
||||||
request.open('POST', this.host, async);
|
|
||||||
request.setRequestHeader('Content-Type','application/json');
|
|
||||||
request.setRequestHeader('Authorization', this.authorizationHeader);
|
|
||||||
return request;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Should be called to make sync request
|
|
||||||
*
|
|
||||||
* @method send
|
|
||||||
* @param {Object} payload
|
|
||||||
* @return {Object} result
|
|
||||||
*/
|
|
||||||
HttpProvider.prototype.send = function (payload) {
|
|
||||||
var request = this.prepareRequest(false);
|
|
||||||
|
|
||||||
try {
|
|
||||||
request.send(JSON.stringify(payload));
|
|
||||||
} catch(error) {
|
|
||||||
throw errors.InvalidConnection(this.host);
|
|
||||||
}
|
|
||||||
|
|
||||||
var result = request.responseText;
|
|
||||||
|
|
||||||
try {
|
|
||||||
result = JSON.parse(result);
|
|
||||||
} catch(e) {
|
|
||||||
throw errors.InvalidResponse(request.responseText);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Should be used to make async request
|
|
||||||
*
|
|
||||||
* @method sendAsync
|
|
||||||
* @param {Object} payload
|
|
||||||
* @param {Function} callback triggered on end with (err, result)
|
|
||||||
*/
|
|
||||||
HttpProvider.prototype.sendAsync = function (payload, callback) {
|
|
||||||
var request = this.prepareRequest(true);
|
|
||||||
|
|
||||||
request.onreadystatechange = function() {
|
|
||||||
if (request.readyState === 4) {
|
|
||||||
var result = request.responseText;
|
|
||||||
var error = null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
result = JSON.parse(result);
|
|
||||||
} catch(e) {
|
|
||||||
error = errors.InvalidResponse(request.responseText);
|
|
||||||
}
|
|
||||||
|
|
||||||
callback(error, result);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
try {
|
|
||||||
request.send(JSON.stringify(payload));
|
|
||||||
} catch(error) {
|
|
||||||
callback(errors.InvalidConnection(this.host));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Synchronously tries to make Http request
|
|
||||||
*
|
|
||||||
* @method isConnected
|
|
||||||
* @return {Boolean} returns true if request haven't failed. Otherwise false
|
|
||||||
*/
|
|
||||||
HttpProvider.prototype.isConnected = function() {
|
|
||||||
try {
|
|
||||||
this.send({
|
|
||||||
id: 9999999999,
|
|
||||||
jsonrpc: '2.0',
|
|
||||||
method: 'net_listening',
|
|
||||||
params: []
|
|
||||||
});
|
|
||||||
return true;
|
|
||||||
} catch(e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = HttpProvider;
|
|
||||||
|
|
|
@ -1,173 +0,0 @@
|
||||||
module.exports = function (app) {
|
|
||||||
var web3 = app.web3;
|
|
||||||
var generateError = app.generateError;
|
|
||||||
|
|
||||||
var contract;
|
|
||||||
app.attachToContract = attachToContract;
|
|
||||||
|
|
||||||
var contractABI = app.config.smartContract.abi;
|
|
||||||
|
|
||||||
function attachToContract(cb) {
|
|
||||||
if(!web3.isConnected()) {
|
|
||||||
if (cb) cb({code: 200, title: "Error", message: "check RPC"}, null);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log(web3.eth.accounts);
|
|
||||||
web3.eth.defaultAccount = web3.eth.accounts[0];
|
|
||||||
console.log("web3.eth.defaultAccount:");
|
|
||||||
console.log(web3.eth.defaultAccount);
|
|
||||||
|
|
||||||
var MyContract = web3.eth.contract(contractABI);
|
|
||||||
contract = MyContract.at(app.contractAddress);
|
|
||||||
|
|
||||||
if (cb) cb(null, contract);
|
|
||||||
}
|
|
||||||
|
|
||||||
function newPhoneToAddr(wallet, phone, cb) {
|
|
||||||
if(!web3.isConnected()) {
|
|
||||||
if (cb) cb({code: 500, title: "Error", message: "check RPC"}, null);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
contract.newPhoneToAddr.sendTransaction(wallet, phone, {gas: 100000, from: web3.eth.defaultAccount}, function(err, result) {
|
|
||||||
cb(err, result);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
app.post('/newPhoneToAddr', function(request, response) {
|
|
||||||
var globalToken = request.body.globalToken;
|
|
||||||
|
|
||||||
if (globalToken != app.config.globalToken) {
|
|
||||||
generateError(response, 401, "Unauthorized", "Wrong app token");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var phone = parseInt(request.body.phone);
|
|
||||||
var wallet = request.body.wallet;
|
|
||||||
var code = request.body.code;
|
|
||||||
console.log(wallet);
|
|
||||||
console.log(request.body.wallet);
|
|
||||||
var isHex = /^0x[0-9A-Fa-f]{40}$/i.test(wallet);
|
|
||||||
|
|
||||||
if (!isHex) {
|
|
||||||
generateError(response, 500, "Error", "Not valid address");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!contract) {
|
|
||||||
generateError(response, 500, "Error", "RPC doesn't work");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
contract.getPaymentByAddress.call(wallet, function(err, val) {
|
|
||||||
console.log("err:");
|
|
||||||
console.log(err);
|
|
||||||
console.log("val:");
|
|
||||||
console.log(val);
|
|
||||||
|
|
||||||
if (val <= 0) {
|
|
||||||
generateError(response, 1000, "Warning", "Payment wasn't sent yet");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
contract.getPaymentDataByAddress.call(wallet, function(err, paymentData) {
|
|
||||||
console.log("err:");
|
|
||||||
console.log(err);
|
|
||||||
console.log("paymentData:");
|
|
||||||
console.log(paymentData);
|
|
||||||
|
|
||||||
|
|
||||||
var hash = app.crypto.createHmac('sha256', app.config.salt)
|
|
||||||
.update(code)
|
|
||||||
.digest('hex');
|
|
||||||
|
|
||||||
console.log("hash:");
|
|
||||||
console.log(hash);
|
|
||||||
|
|
||||||
//var hashBuf = new Buffer(hash, 'binary').toString('hex');
|
|
||||||
//console.log("hashBuf:");
|
|
||||||
//console.log(hashBuf.toString());
|
|
||||||
|
|
||||||
console.log(paymentData.substring(2) + " == " + hash);
|
|
||||||
if (paymentData.substring(2) != hash) {
|
|
||||||
generateError(response, 1000, "Warning", "Sent message doesn't match with the one displayed on the page");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
newPhoneToAddr(wallet, phone, function(err, result) {
|
|
||||||
console.log(err);
|
|
||||||
console.log(result);
|
|
||||||
response.send({
|
|
||||||
success : {
|
|
||||||
code : 200,
|
|
||||||
title : "Success",
|
|
||||||
message : "Phone successfully joined"
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
app.post('/getPhoneByAddress', function(request, response) {
|
|
||||||
var globalToken = request.body.globalToken;
|
|
||||||
if (globalToken != app.config.globalToken) {
|
|
||||||
generateError(response, 401, "Unauthorized", "Wrong app token");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var wallet = request.body.wallet;
|
|
||||||
var isHex = /^0x[0-9A-Fa-f]{40}$/i.test(wallet);
|
|
||||||
if (!isHex) {
|
|
||||||
generateError(response, 500, "Error", "Not valid address");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!contract) {
|
|
||||||
generateError(response, 500, "Error", "RPC doesn't work");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var phone = contract.getPhoneByAddress.call(wallet, function(err, obj) {
|
|
||||||
console.log("err:");
|
|
||||||
console.log(err);
|
|
||||||
console.log("obj:");
|
|
||||||
console.log(obj);
|
|
||||||
response.send({
|
|
||||||
success : {
|
|
||||||
code : 200,
|
|
||||||
title : "Success",
|
|
||||||
message : "Phone successfully joined",
|
|
||||||
phone: obj
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
app.post('/getAddressByPhone', function(request, response) {
|
|
||||||
var globalToken = request.body.globalToken;
|
|
||||||
if (globalToken != app.config.globalToken) {
|
|
||||||
generateError(response, 401, "Unauthorized", "Wrong app token");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!contract) {
|
|
||||||
generateError(response, 500, "Error", "RPC doesn't work");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var phone = parseInt(request.body.phone);
|
|
||||||
var address = contract.phones.call(phone, function(err, address) {
|
|
||||||
console.log(address);
|
|
||||||
response.send({
|
|
||||||
success : {
|
|
||||||
code : 200,
|
|
||||||
title : "Success",
|
|
||||||
message : "Phone successfully joined",
|
|
||||||
addr: address
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
|
@ -96,7 +96,7 @@ div.inputContainer {
|
||||||
input.POPInput {
|
input.POPInput {
|
||||||
font-family: 'Open Sans', sans-serif;
|
font-family: 'Open Sans', sans-serif;
|
||||||
height: 56px;
|
height: 56px;
|
||||||
width: 400px;
|
width: 340px;
|
||||||
border: none;
|
border: none;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
|
@ -109,6 +109,8 @@ input.POPInput:focus {
|
||||||
outline-width: 2px;*/
|
outline-width: 2px;*/
|
||||||
/*box-shadow: 0 0 0 1pt rgb(87,196,223);*/
|
/*box-shadow: 0 0 0 1pt rgb(87,196,223);*/
|
||||||
padding-left: 48px;
|
padding-left: 48px;
|
||||||
|
width: 338px;
|
||||||
|
height: 52px;
|
||||||
border: 2px solid rgb(87,196,223) !important;
|
border: 2px solid rgb(87,196,223) !important;
|
||||||
}
|
}
|
||||||
input.POPInput.POPInputPhone {
|
input.POPInput.POPInputPhone {
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -20,7 +20,7 @@ gulp.task('javascript', function() {
|
||||||
], {base: '.'}))
|
], {base: '.'}))
|
||||||
.pipe(include())
|
.pipe(include())
|
||||||
.pipe(concat('application.js'))
|
.pipe(concat('application.js'))
|
||||||
.pipe(uglify())
|
//.pipe(uglify())
|
||||||
.pipe(gulp.dest('javascripts'));
|
.pipe(gulp.dest('javascripts'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Binary file not shown.
File diff suppressed because one or more lines are too long
|
@ -1,26 +0,0 @@
|
||||||
function addPhoneToWallet(phone, wallet, code, changeStepNumber, cb) {
|
|
||||||
$.post("/newPhoneToAddr", {
|
|
||||||
"globalToken": "cba2c691-47df-41e7-bc97-a0818103ed14",
|
|
||||||
"phone": phone,
|
|
||||||
"wallet": wallet,
|
|
||||||
"code": code
|
|
||||||
}, function( data ) {
|
|
||||||
cb();
|
|
||||||
|
|
||||||
if (data.success) {
|
|
||||||
changeStepNumber(+1, null);
|
|
||||||
} else if (data.error.code == 1000) {
|
|
||||||
swal({
|
|
||||||
title: "Warning",
|
|
||||||
text: data.error.message,
|
|
||||||
type: "warning"
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
swal({
|
|
||||||
title: "Error",
|
|
||||||
text: data.error.message,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
function addToken(web3, config, sender, phoneNumber, token, cb) {
|
||||||
|
console.log(web3);
|
||||||
|
attachToContract(web3, config, function(err, contract) {
|
||||||
|
newTokenTX(web3, contract, sender, phoneNumber, token, function(err, txHash) {
|
||||||
|
//console.log("newTokenTX:");
|
||||||
|
//console.log("result: " + txHash);
|
||||||
|
cb(err, txHash);
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function newTokenTX(web3, contract, sender, phoneNumber, token, cb) {
|
||||||
|
if (!web3.isConnected()) return cb({code: 500, title: "Error", message: "check RPC"}, null);
|
||||||
|
|
||||||
|
contract.newToken.sendTransaction(phoneNumber, token, {gas: 800000, from: sender}, function(err, result) {
|
||||||
|
cb(err, result);
|
||||||
|
});
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
function showAlert(err, msg) {
|
||||||
|
if (!err) {
|
||||||
|
swal({
|
||||||
|
title: "Error",
|
||||||
|
text: msg,
|
||||||
|
type: "error"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (err.type != "REQUEST_REJECTED") {
|
||||||
|
swal({
|
||||||
|
title: "Error",
|
||||||
|
text: msg,
|
||||||
|
type: "error"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
function attachToContract(web3, config, cb) {
|
||||||
|
if(!web3.isConnected()) {
|
||||||
|
if (cb) cb({code: 200, title: "Error", message: "check RPC"}, null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(web3.eth.accounts);
|
||||||
|
web3.eth.defaultAccount = web3.eth.accounts[0];
|
||||||
|
console.log("web3.eth.defaultAccount:");
|
||||||
|
console.log(web3.eth.defaultAccount);
|
||||||
|
|
||||||
|
var MyContract = web3.eth.contract(config.Ethereum.contracts.ProofOfPhone.abi);
|
||||||
|
|
||||||
|
contract = MyContract.at(config.Ethereum[config.environment].contractAddress);
|
||||||
|
|
||||||
|
if (cb) cb(null, contract);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getTxCallBack(txHash, cb) {
|
||||||
|
web3.eth.getTransaction(txHash, function(err, txDetails) {
|
||||||
|
if (err) console.log(err);
|
||||||
|
if (!txDetails) {
|
||||||
|
setTimeout(function() {
|
||||||
|
getTxCallBack(txHash, cb);
|
||||||
|
}, 2000);
|
||||||
|
} else if (!txDetails.blockNumber) {
|
||||||
|
setTimeout(function() {
|
||||||
|
getTxCallBack(txHash, cb);
|
||||||
|
}, 2000)
|
||||||
|
} else cb();
|
||||||
|
});
|
||||||
|
};
|
|
@ -0,0 +1,35 @@
|
||||||
|
//check current network page is connected to. Alerts, if not Oracles network
|
||||||
|
function checkNetworkVersion(web3, cb) {
|
||||||
|
var msgNotOracles = "You aren't connected to Oracles network. Please, switch on Oracles plugin and choose Oracles network. Check Oracles network <a href='https://github.com/oraclesorg/oracles-wiki' target='blank'>wiki</a> for more info.";
|
||||||
|
web3.version.getNetwork(function(err, netId) {
|
||||||
|
if (err)
|
||||||
|
console.log(err);
|
||||||
|
console.log("netId: " + netId);
|
||||||
|
switch (netId) {
|
||||||
|
case "1": {
|
||||||
|
console.log('This is mainnet');
|
||||||
|
swal("Warning", msgNotOracles, "warning");
|
||||||
|
cb(false);
|
||||||
|
} break;
|
||||||
|
case "2": {
|
||||||
|
console.log('This is the deprecated Morden test network.');
|
||||||
|
swal("Warning", msgNotOracles, "warning");
|
||||||
|
cb(false);
|
||||||
|
} break;
|
||||||
|
case "3": {
|
||||||
|
console.log('This is the ropsten test network.');
|
||||||
|
swal("Warning", msgNotOracles, "warning");
|
||||||
|
cb(false);
|
||||||
|
} break;
|
||||||
|
case "12648430": {
|
||||||
|
console.log('This is Oracles from Metamask');
|
||||||
|
cb(true);
|
||||||
|
} break;
|
||||||
|
default: {
|
||||||
|
console.log('This is an unknown network.');
|
||||||
|
swal("Warning", msgNotOracles, "warning");
|
||||||
|
cb(false);
|
||||||
|
} break;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
function deployContract(web3, config, sender) {
|
||||||
|
var contractABI = config.Ethereum.contracts.ProofOfPhone.abi;
|
||||||
|
var compiled = config.Ethereum.contracts.ProofOfPhone.bin;
|
||||||
|
|
||||||
|
console.log(web3.eth.accounts);
|
||||||
|
web3.eth.defaultAccount = web3.eth.accounts[0];
|
||||||
|
|
||||||
|
var gasWillUsed = web3.eth.estimateGas({
|
||||||
|
from: web3.eth.defaultAccount,
|
||||||
|
data: compiled
|
||||||
|
}, function(err, gasWillUsed) {
|
||||||
|
console.log(gasWillUsed);
|
||||||
|
gasWillUsed += 30000;
|
||||||
|
|
||||||
|
var proofOfPhoneContract = web3.eth.contract(contractABI);
|
||||||
|
proofOfPhoneContract.new(
|
||||||
|
{
|
||||||
|
data: compiled,
|
||||||
|
gas: gasWillUsed,
|
||||||
|
from: sender
|
||||||
|
}, function(err, contract) {
|
||||||
|
if (!err) {
|
||||||
|
if (typeof contract.address != 'undefined') {
|
||||||
|
console.log("contract:");
|
||||||
|
console.log(contract);
|
||||||
|
|
||||||
|
console.log('Contract mined! address: ' + contract.address + ' transactionHash: ' + contract.transactionHash);
|
||||||
|
} else {
|
||||||
|
console.log(contract.transactionHash);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.log("error:");
|
||||||
|
console.log(err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
//get current account chosen in MetaMask or opened at Parity
|
||||||
|
function getAccounts(cb) {
|
||||||
|
web3.eth.getAccounts(function(err, accounts) {
|
||||||
|
if (err) {
|
||||||
|
$(".loading-container").hide();
|
||||||
|
showAlert(err, err.message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
cb(accounts);
|
||||||
|
});
|
||||||
|
}
|
|
@ -1,27 +1,23 @@
|
||||||
function getAddressByPhone(phone, changeStepNumber, cb) {
|
function getAddressByPhone(web3, config, sender, phoneNumber, cb) {
|
||||||
$.post("/getAddressByPhone", {
|
attachToContract(web3, config, function(err, contract) {
|
||||||
"globalToken": "cba2c691-47df-41e7-bc97-a0818103ed14",
|
getAddressByPhoneCall(web3, contract, sender, phoneNumber, function(err, addr) {
|
||||||
"phone": phone
|
if (err) {
|
||||||
}, function( data ) {
|
console.log("error: " + err);
|
||||||
cb();
|
cb(err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
console.log("getAddressByPhoneCall:");
|
||||||
|
console.log("addr: " + addr);
|
||||||
|
cb(null, addr);
|
||||||
|
});
|
||||||
|
|
||||||
if (data.success) {
|
});
|
||||||
if (data.success.addr != "0x0000000000000000000000000000000000000000") {
|
}
|
||||||
POPInputWallet.val(data.success.addr);
|
|
||||||
changeStepNumber(null, 4);
|
function getAddressByPhoneCall(web3, contract, sender, phoneNumber, cb) {
|
||||||
} else {
|
if (!web3.isConnected()) cb({code: 500, title: "Error", message: "check RPC"}, null);
|
||||||
swal({
|
|
||||||
title: "Warning",
|
contract.getAddressByPhone.call(phoneNumber, {from: sender}, function(err, result) {
|
||||||
text: "This phone wasn't set for any wallet yet",
|
cb(err, result);
|
||||||
type: "warning"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
swal({
|
|
||||||
title: "Error",
|
|
||||||
text: data.error.message,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
//gets config file with address of Oracles contract
|
||||||
|
function getConfig(cb) {
|
||||||
|
$.getJSON("./javascripts/config.json", function(config) {
|
||||||
|
cb(config);
|
||||||
|
});
|
||||||
|
}
|
|
@ -1,28 +1,23 @@
|
||||||
function getPhoneByAddress(wallet, changeStepNumber, cb) {
|
function getPhoneByAddress(web3, config, sender, addr, cb) {
|
||||||
$.post("/getPhoneByAddress", {
|
attachToContract(web3, config, function(err, contract) {
|
||||||
"globalToken": "cba2c691-47df-41e7-bc97-a0818103ed14",
|
getPhoneByAddressCall(web3, contract, sender, addr, function(err, phone) {
|
||||||
"wallet": wallet
|
if (err) {
|
||||||
}, function( data ) {
|
console.log("error: " + err);
|
||||||
cb();
|
cb(err);
|
||||||
|
return;
|
||||||
if (data.success) {
|
|
||||||
if (data.success.phone != 0) {
|
|
||||||
POPInputPhone.val(data.success.phone);
|
|
||||||
changeStepNumber(null, 4);
|
|
||||||
} else {
|
|
||||||
swal({
|
|
||||||
title: "Warning",
|
|
||||||
text: "Phone wasn't set for this wallet yet",
|
|
||||||
type: "warning"
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
console.log("getPhoneByAddressCall:");
|
||||||
} else {
|
console.log("phone: " + phone);
|
||||||
swal({
|
cb(null, phone);
|
||||||
title: "Error",
|
|
||||||
text: data.error.message,
|
|
||||||
type: "error"
|
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function getPhoneByAddressCall(web3, contract, sender, addr, cb) {
|
||||||
|
if (!web3.isConnected()) cb({code: 500, title: "Error", message: "check RPC"}, null);
|
||||||
|
|
||||||
|
contract.getPhoneByAddress.call(addr, {from: sender}, function(err, result) {
|
||||||
|
cb(err, result);
|
||||||
});
|
});
|
||||||
}
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
//gets web3 object from MetaMask or Parity
|
||||||
|
function getWeb3(callback) {
|
||||||
|
if (typeof window.web3 === 'undefined') {
|
||||||
|
// no web3, use fallback
|
||||||
|
console.error("Please use a web3 browser");
|
||||||
|
var msgNotEthereum = "You aren't connected to Oracles Network. Please, switch on Oracles plugin and refresh the page. Check Oracles network <a href='https://github.com/oraclesorg/oracles-wiki' target='blank'>wiki</a> for more info.";
|
||||||
|
swal("Warning", msgNotEthereum, "warning");
|
||||||
|
callback(myWeb3, false);
|
||||||
|
} else {
|
||||||
|
// window.web3 == web3 most of the time. Don't override the provided,
|
||||||
|
// web3, just wrap it in your Web3.
|
||||||
|
var myWeb3 = new Web3(window.web3.currentProvider);
|
||||||
|
|
||||||
|
// the default account doesn't seem to be persisted, copy it to our
|
||||||
|
// new instance
|
||||||
|
myWeb3.eth.defaultAccount = window.web3.eth.defaultAccount;
|
||||||
|
|
||||||
|
checkNetworkVersion(myWeb3, function(isOraclesNetwork) {
|
||||||
|
callback(myWeb3, isOraclesNetwork);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,15 @@
|
||||||
$(document).ready(function() {
|
//launches main application
|
||||||
|
function startDapp(web3, isOraclesNetwork) {
|
||||||
|
console.log(web3);
|
||||||
|
var sender;
|
||||||
|
$(function() {
|
||||||
|
if (!isOraclesNetwork) return;
|
||||||
|
getAccounts(function(accounts) {
|
||||||
|
getConfig(function(config) {
|
||||||
|
getConfigCallBack(web3, accounts, config);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
var stepNum = $('#stepNum');
|
var stepNum = $('#stepNum');
|
||||||
var stepLabel = $('.POPLabel');
|
var stepLabel = $('.POPLabel');
|
||||||
var stepTitle = $('.POPTitle');
|
var stepTitle = $('.POPTitle');
|
||||||
|
@ -27,6 +38,7 @@ $(document).ready(function() {
|
||||||
var githubRibbon = $('.githubRibbon');
|
var githubRibbon = $('.githubRibbon');
|
||||||
var copyTable = $('.copyTable');
|
var copyTable = $('.copyTable');
|
||||||
var copyTableCellWalletValue1 = $('.copyTableCellWalletValue1');
|
var copyTableCellWalletValue1 = $('.copyTableCellWalletValue1');
|
||||||
|
copyTableCellWalletValue1.text("0xf7e9626dbaeb1a6c8b3d02379eb54b81f16e785f");
|
||||||
var copyTableCellWalletValue2 = $('.copyTableCellWalletValue2');
|
var copyTableCellWalletValue2 = $('.copyTableCellWalletValue2');
|
||||||
|
|
||||||
var POPTitleContainer = $('.POPTitleContainer');
|
var POPTitleContainer = $('.POPTitleContainer');
|
||||||
|
@ -39,7 +51,6 @@ $(document).ready(function() {
|
||||||
|
|
||||||
var checkButton = $('#verifyButton');
|
var checkButton = $('#verifyButton');
|
||||||
|
|
||||||
//location.reload();
|
|
||||||
var topLabel = $('.topLabel');
|
var topLabel = $('.topLabel');
|
||||||
var bottomLabelRight = $('.bottomLabelRight');
|
var bottomLabelRight = $('.bottomLabelRight');
|
||||||
var homeButton = $('.homeButton');
|
var homeButton = $('.homeButton');
|
||||||
|
@ -47,7 +58,6 @@ $(document).ready(function() {
|
||||||
var shareButton = $('.shareButton');
|
var shareButton = $('.shareButton');
|
||||||
|
|
||||||
var copyHashTable = $('#copyHashTable');
|
var copyHashTable = $('#copyHashTable');
|
||||||
var hashToAddress = "";
|
|
||||||
|
|
||||||
var checkboxContainer = $(".checkboxContainer");
|
var checkboxContainer = $(".checkboxContainer");
|
||||||
var POPcheckbox = $(".POPcheckbox");
|
var POPcheckbox = $(".POPcheckbox");
|
||||||
|
@ -55,18 +65,27 @@ $(document).ready(function() {
|
||||||
|
|
||||||
var addressVal = $("#addressVal");
|
var addressVal = $("#addressVal");
|
||||||
|
|
||||||
|
function getConfigCallBack(web3, accounts, config) {
|
||||||
|
console.log(accounts);
|
||||||
|
if (accounts.length == 1) {
|
||||||
|
sender = accounts[0];
|
||||||
|
POPInputWallet.val(sender);
|
||||||
|
} else {
|
||||||
|
swal("Warning", "You haven't chosen any account in Oracles plugin. Please, choose your account in Oracles plugin and reload the page. Check Oracles network <a href='https://github.com/oraclesorg/oracles-wiki' target='blank'>wiki</a> for more info.", "warning");
|
||||||
|
}
|
||||||
|
|
||||||
var wallet = QueryString.wallet;
|
var wallet = QueryString.wallet;
|
||||||
if (wallet) {
|
if (wallet) {
|
||||||
POPInputWallet.val(wallet);
|
POPInputWallet.val(wallet);
|
||||||
changeStepNumber(null, 5);
|
changeStepNumber(null, 4);
|
||||||
walletRadioCheck();
|
walletRadioCheck();
|
||||||
getPhoneByAddress(POPInputWallet.val(), changeStepNumber, function(err, output) {
|
getPhoneByAddress(web3, config, sender, POPInputWallet.val(), function(err, phone) {
|
||||||
middleMainContainerInner.fadeIn(500);
|
middleMainContainerInner.fadeIn(500);
|
||||||
loader.addClass('hide');
|
loader.addClass('hide');
|
||||||
if (!err) {
|
if (!err) {
|
||||||
if (output != 0) {
|
if (phone != 0) {
|
||||||
POPInputPhone.val(output);
|
POPInputPhone.val(phone);
|
||||||
changeStepNumber(null, 4);
|
changeStepNumber(null, 3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -113,36 +132,10 @@ $(document).ready(function() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function phoneRadioCheck() {
|
|
||||||
POPradios.each(function(e) {
|
|
||||||
$(this).find('.POPRadioInner').removeClass('POPradioSelected');
|
|
||||||
$(this).find('.POPRadioInner').addClass('POPradioUnselected');
|
|
||||||
});
|
|
||||||
phoneRadio.find('.POPRadioInner').removeClass('POPradioUnselected');
|
|
||||||
phoneRadio.find('.POPRadioInner').addClass('POPradioSelected');
|
|
||||||
POPInputPhone.removeClass('hide');
|
|
||||||
POPInputPhone.focus();
|
|
||||||
POPInputWallet.addClass('hide');
|
|
||||||
$("#radioCheckPhone").prop("checked", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
walletRadio.click(function(e) {
|
walletRadio.click(function(e) {
|
||||||
walletRadioCheck();
|
walletRadioCheck();
|
||||||
});
|
});
|
||||||
|
|
||||||
function walletRadioCheck() {
|
|
||||||
POPradios.each(function(e) {
|
|
||||||
$(this).find('.POPRadioInner').removeClass('POPradioSelected');
|
|
||||||
$(this).find('.POPRadioInner').addClass('POPradioUnselected');
|
|
||||||
});
|
|
||||||
walletRadio.find('.POPRadioInner').removeClass('POPradioUnselected');
|
|
||||||
walletRadio.find('.POPRadioInner').addClass('POPradioSelected');
|
|
||||||
POPInputWallet.removeClass('hide');
|
|
||||||
POPInputWallet.focus();
|
|
||||||
POPInputPhone.addClass('hide');
|
|
||||||
$("#radioCheckWallet").prop("checked", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
topLabel.click(function(e) {
|
topLabel.click(function(e) {
|
||||||
location.reload();
|
location.reload();
|
||||||
});
|
});
|
||||||
|
@ -160,17 +153,16 @@ $(document).ready(function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
checkButton.click(function(e) {
|
checkButton.click(function(e) {
|
||||||
changeStepNumber(null, 5);
|
changeStepNumber(null, 4);
|
||||||
});
|
});
|
||||||
|
|
||||||
POPSubmit.click(function(e) {
|
POPSubmit.click(function(e) {
|
||||||
submit();
|
submit(config, sender);
|
||||||
});
|
});
|
||||||
|
|
||||||
POPInputPhone.keypress(function (e) {
|
POPInputPhone.keypress(function (e) {
|
||||||
var key = e.which;
|
var key = e.which;
|
||||||
if(key == 13) // the enter key code
|
if (key == 13) { // the enter key code
|
||||||
{
|
|
||||||
POPSubmit.click();
|
POPSubmit.click();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -178,8 +170,7 @@ $(document).ready(function() {
|
||||||
|
|
||||||
POPInputSMS.keypress(function (e) {
|
POPInputSMS.keypress(function (e) {
|
||||||
var key = e.which;
|
var key = e.which;
|
||||||
if(key == 13) // the enter key code
|
if (key == 13) { // the enter key code
|
||||||
{
|
|
||||||
POPSubmit.click();
|
POPSubmit.click();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -187,48 +178,128 @@ $(document).ready(function() {
|
||||||
|
|
||||||
POPInputWallet.keypress(function (e) {
|
POPInputWallet.keypress(function (e) {
|
||||||
var key = e.which;
|
var key = e.which;
|
||||||
if(key == 13) // the enter key code
|
if (key == 13) { // the enter key code
|
||||||
{
|
|
||||||
POPSubmit.click();
|
POPSubmit.click();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function submit() {
|
function phoneRadioCheck() {
|
||||||
|
POPradios.each(function(e) {
|
||||||
|
$(this).find('.POPRadioInner').removeClass('POPradioSelected');
|
||||||
|
$(this).find('.POPRadioInner').addClass('POPradioUnselected');
|
||||||
|
});
|
||||||
|
phoneRadio.find('.POPRadioInner').removeClass('POPradioUnselected');
|
||||||
|
phoneRadio.find('.POPRadioInner').addClass('POPradioSelected');
|
||||||
|
POPInputPhone.removeClass('hide');
|
||||||
|
POPInputPhone.focus();
|
||||||
|
POPInputWallet.addClass('hide');
|
||||||
|
$("#radioCheckPhone").prop("checked", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
function walletRadioCheck() {
|
||||||
|
POPradios.each(function(e) {
|
||||||
|
$(this).find('.POPRadioInner').removeClass('POPradioSelected');
|
||||||
|
$(this).find('.POPRadioInner').addClass('POPradioUnselected');
|
||||||
|
});
|
||||||
|
walletRadio.find('.POPRadioInner').removeClass('POPradioUnselected');
|
||||||
|
walletRadio.find('.POPRadioInner').addClass('POPradioSelected');
|
||||||
|
POPInputWallet.removeClass('hide');
|
||||||
|
POPInputWallet.focus();
|
||||||
|
POPInputPhone.addClass('hide');
|
||||||
|
$("#radioCheckWallet").prop("checked", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
function submit(config, sender) {
|
||||||
var visibleInput = $('input:visible');
|
var visibleInput = $('input:visible');
|
||||||
var curStepNum = parseInt(stepNum.val());
|
var curStepNum = parseInt(stepNum.val());
|
||||||
if (visibleInput.val() != "") {
|
if (visibleInput.val() != "") {
|
||||||
middleMainContainerInner.fadeOut(500);
|
middleMainContainerInner.fadeOut(500);
|
||||||
loader.removeClass('hide');
|
loader.removeClass('hide');
|
||||||
switch(curStepNum) {
|
switch(curStepNum) {
|
||||||
case 1:
|
case 1: {
|
||||||
sendCodeBySMS(visibleInput.val(), changeStepNumber, function() {
|
var phoneNumber = parseInt(visibleInput.val());
|
||||||
|
sendCodeBySMS(phoneNumber, function(err, token) {
|
||||||
|
if (err) {
|
||||||
|
middleMainContainerInner.fadeIn(500);
|
||||||
|
loader.addClass('hide');
|
||||||
|
return showAlert(err, err.message);
|
||||||
|
}
|
||||||
|
addToken(web3, config, sender, phoneNumber, token, function(err, txHash) {
|
||||||
|
if (err) {
|
||||||
|
if (err.type != "REQUEST_REJECTED") showAlert(err, err.message);
|
||||||
|
middleMainContainerInner.fadeIn(500);
|
||||||
|
loader.addClass('hide');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (txHash) {
|
||||||
|
getTxCallBack(txHash, function() {
|
||||||
|
changeStepNumber(+1, null);
|
||||||
|
middleMainContainerInner.fadeIn(500);
|
||||||
|
loader.addClass('hide');
|
||||||
|
swal({
|
||||||
|
title: "Success",
|
||||||
|
text: "Code successfully sent by SMS",
|
||||||
|
type: "success"
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} break;
|
||||||
|
case 2: {
|
||||||
|
var code = POPInputSMS.val();
|
||||||
|
var token = web3.sha3(code);
|
||||||
|
verifyCodeFromSMS(web3, config, sender, token, function(err, txHash) {
|
||||||
|
if (err) {
|
||||||
|
if (err.type != "REQUEST_REJECTED") showAlert(null, "Invalid code entered");
|
||||||
|
middleMainContainerInner.fadeIn(500);
|
||||||
|
loader.addClass('hide');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (txHash) {
|
||||||
|
getTxCallBack(txHash, function() {
|
||||||
|
changeStepNumber(+1, null);
|
||||||
middleMainContainerInner.fadeIn(500);
|
middleMainContainerInner.fadeIn(500);
|
||||||
loader.addClass('hide');
|
loader.addClass('hide');
|
||||||
});
|
});
|
||||||
break;
|
}
|
||||||
case 2:
|
|
||||||
verifyCodeFromSMS(POPInputSMS.val(), POPInputPhone.val(), changeStepNumber, function() {
|
|
||||||
middleMainContainerInner.fadeIn(500);
|
|
||||||
loader.addClass('hide');
|
|
||||||
});
|
});
|
||||||
break;
|
} break;
|
||||||
case 3:
|
case 4:
|
||||||
addPhoneToWallet(POPInputPhone.val(), POPInputWallet.val(), POPInputSMS.val(), changeStepNumber, function() {
|
|
||||||
middleMainContainerInner.fadeIn(500);
|
|
||||||
loader.addClass('hide');
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
{
|
{
|
||||||
var radioVal = $('input[name=radioCheck]:checked').val();
|
var radioVal = $('input[name=radioCheck]:checked').val();
|
||||||
if (radioVal == "wallet") {
|
if (radioVal == "wallet") {
|
||||||
getPhoneByAddress(POPInputWallet.val(), changeStepNumber, function() {
|
getPhoneByAddress(web3, config, sender, POPInputWallet.val(), function(err, phone) {
|
||||||
|
if (err) return showAlert(err, err.message);
|
||||||
|
console.log(phone);
|
||||||
|
if (phone != 0) {
|
||||||
|
POPInputPhone.val(phone);
|
||||||
|
changeStepNumber(null, 3);
|
||||||
|
} else {
|
||||||
|
swal({
|
||||||
|
title: "Warning",
|
||||||
|
text: "Phone wasn't set for this wallet yet",
|
||||||
|
type: "warning"
|
||||||
|
});
|
||||||
|
}
|
||||||
middleMainContainerInner.fadeIn(500);
|
middleMainContainerInner.fadeIn(500);
|
||||||
loader.addClass('hide');
|
loader.addClass('hide');
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
getAddressByPhone(POPInputPhone.val(), changeStepNumber, function() {
|
getAddressByPhone(web3, config, sender, POPInputPhone.val(), function(err, addr) {
|
||||||
|
if (err) return showAlert(err, err.message);
|
||||||
|
if (addr != "0x0000000000000000000000000000000000000000" && addr != "0x") {
|
||||||
|
POPInputWallet.val(addr);
|
||||||
|
changeStepNumber(null, 3);
|
||||||
|
} else {
|
||||||
|
swal({
|
||||||
|
title: "Warning",
|
||||||
|
text: "This phone wasn't set for any wallet yet",
|
||||||
|
type: "warning"
|
||||||
|
});
|
||||||
|
}
|
||||||
middleMainContainerInner.fadeIn(500);
|
middleMainContainerInner.fadeIn(500);
|
||||||
loader.addClass('hide');
|
loader.addClass('hide');
|
||||||
});
|
});
|
||||||
|
@ -246,7 +317,6 @@ $(document).ready(function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeStepNumber(addition, absolute) {
|
function changeStepNumber(addition, absolute) {
|
||||||
console.log(hashToAddress);
|
|
||||||
var newStepVal = 0;
|
var newStepVal = 0;
|
||||||
if (addition) newStepVal = parseInt(stepNum.val()) + addition;
|
if (addition) newStepVal = parseInt(stepNum.val()) + addition;
|
||||||
else newStepVal = absolute;
|
else newStepVal = absolute;
|
||||||
|
@ -307,56 +377,11 @@ $(document).ready(function() {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
{
|
|
||||||
stepTitle.text("Submit your Ethereum address");
|
|
||||||
bottomDesc.text("Deposit service fee of 0.1 ETH to a smart contract with a message");
|
|
||||||
|
|
||||||
$("#hashVal").text(hashToAddress);
|
|
||||||
var clientCopyHash = new ZeroClipboard( document.getElementById("hashCopy") );
|
|
||||||
|
|
||||||
clientCopyHash.on( "ready", function( readyEvent ) {
|
|
||||||
clientCopyHash.on( "beforecopy", function( event ) {
|
|
||||||
$("#hashCopy").attr("data-clipboard-text", hashToAddress);
|
|
||||||
});
|
|
||||||
clientCopyHash.on( "aftercopy", function( event ) {
|
|
||||||
Materialize.toast('message copied to buffer', 3000, 'rounded');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
bottomDescAddition.html("at the address");
|
|
||||||
stepLabel.removeClass("hide");
|
|
||||||
radioContainer.addClass("hide");
|
|
||||||
inputContainer.show();
|
|
||||||
POPBottomDescriptionContainer.show();
|
|
||||||
POPInputPhone.addClass('hide');
|
|
||||||
POPInputSMS.addClass('hide');
|
|
||||||
POPInputWallet.removeClass('hide');
|
|
||||||
POPInputWallet.focus();
|
|
||||||
POPBottomDescriptionContainer.removeClass("hide");
|
|
||||||
step1CopyTable.addClass("hide");
|
|
||||||
step3CopyTable.removeClass("hide");
|
|
||||||
bottomDescAddition.removeClass("hide");
|
|
||||||
copyHashTable.removeClass("hide");
|
|
||||||
successContainer.addClass("hide");
|
|
||||||
POPTitleContainerShortend.addClass("POPTitleContainer");
|
|
||||||
POPTitleContainerShortend.removeClass("POPTitleContainerShortend");
|
|
||||||
POPDescContainerShortend.addClass("POPDescContainer");
|
|
||||||
POPDescContainerShortend.removeClass("POPDescContainerShortend");
|
|
||||||
checkboxContainer.addClass("hide");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
{
|
{
|
||||||
stepTitle.text("Success");
|
stepTitle.text("Success");
|
||||||
stepLabel.addClass("hide");
|
stepLabel.addClass("hide");
|
||||||
POPBottomDescriptionContainer.hide();
|
POPBottomDescriptionContainer.hide();
|
||||||
/*bottomDescAddition2.html('There is a smart contract has the following public method signature:\
|
bottomDescAddition2.html('There is a smart contract deployed to the Oracles network. You can find it here:\
|
||||||
<table cellspacing="0" cellpadding="0" class="copyTable nomargin" style="display: table;"><tbody class="copyTableBody"><tr><td class="copyTableCellWalletValue1">\
|
|
||||||
hasPhone (address _addr)\
|
|
||||||
</td></tr></tbody></table>\
|
|
||||||
If the _addr is registered in the contract\'s Phone Registry, the hasPhone method returns true. Otherwise it returns false.');
|
|
||||||
*/
|
|
||||||
bottomDescAddition2.html('There is a smart contract deployed to the public ethereum Blockchain. You can find it here:\
|
|
||||||
<table cellspacing="0" cellpadding="0" class="copyTable nomargin" style="display: table;"><tbody class="copyTableBody"><tr><td class="copyTableCellWalletValue2">'
|
<table cellspacing="0" cellpadding="0" class="copyTable nomargin" style="display: table;"><tbody class="copyTableBody"><tr><td class="copyTableCellWalletValue2">'
|
||||||
+ copyTableCellWalletValue1.text() +
|
+ copyTableCellWalletValue1.text() +
|
||||||
'</td><td id="copyWallet3" data-clipboard-text="'+ copyTableCellWalletValue1.text() + '" class="copyTableCellCopyButton"></td></tr></tbody></table>This contract has the following public method signature:\
|
'</td><td id="copyWallet3" data-clipboard-text="'+ copyTableCellWalletValue1.text() + '" class="copyTableCellCopyButton"></td></tr></tbody></table>This contract has the following public method signature:\
|
||||||
|
@ -389,11 +414,11 @@ $(document).ready(function() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 4:
|
||||||
{
|
{
|
||||||
stepTitle.text("Check");
|
stepTitle.text("Check");
|
||||||
bottomDesc.html('Enter a phone number or an ethereum address to continue. <br/>\
|
bottomDesc.html('Enter a phone number or an Ethereum address to continue. <br/>\
|
||||||
There is a smart contract deployed to the public ethereum Blockchain. You can find it here:\
|
There is a smart contract deployed to the Oracles network. You can find it here:\
|
||||||
<table cellspacing="0" cellpadding="0" class="copyTable nomargin" style="display: table;"><tbody class="copyTableBody"><tr><td class="copyTableCellWalletValue2">'
|
<table cellspacing="0" cellpadding="0" class="copyTable nomargin" style="display: table;"><tbody class="copyTableBody"><tr><td class="copyTableCellWalletValue2">'
|
||||||
+ copyTableCellWalletValue1.text() +
|
+ copyTableCellWalletValue1.text() +
|
||||||
'</td><td id="copyWallet2" data-clipboard-text="'+ copyTableCellWalletValue1.text() + '" class="copyTableCellCopyButton"></td></tr></tbody></table>This contract has the following public method signature:\
|
'</td><td id="copyWallet2" data-clipboard-text="'+ copyTableCellWalletValue1.text() + '" class="copyTableCellCopyButton"></td></tr></tbody></table>This contract has the following public method signature:\
|
||||||
|
@ -449,4 +474,9 @@ $(document).ready(function() {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
window.addEventListener('load', function() {
|
||||||
|
getWeb3(startDapp);
|
||||||
});
|
});
|
|
@ -1,23 +1,11 @@
|
||||||
function sendCodeBySMS(phone, changeStepNumber, cb) {
|
function sendCodeBySMS(phone, cb) {
|
||||||
|
//cb(null, "0xc888c9ce9e098d5864d3ded6ebcc140a12142263bace3a23a36f9905f12bd64a");
|
||||||
$.post("/sendCodeBySMS", {
|
$.post("/sendCodeBySMS", {
|
||||||
"globalToken": "cba2c691-47df-41e7-bc97-a0818103ed14",
|
"globalToken": "cba2c691-47df-41e7-bc97-a0818103ed14",
|
||||||
"to": phone
|
"to": phone
|
||||||
}, function( data ) {
|
}, function( data ) {
|
||||||
console.log( data );
|
console.log( data );
|
||||||
if (data.success) {
|
if (data.success) cb(null, data.success.token);
|
||||||
changeStepNumber(+1, null);
|
else cb(data.error, null);
|
||||||
token.val(data.success.code);
|
|
||||||
swal({
|
|
||||||
title: "Success",
|
|
||||||
text: "Code successfully sent by SMS",
|
|
||||||
type: "success"
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
swal({
|
|
||||||
title: "Error",
|
|
||||||
text: data.error.message,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
|
@ -1,27 +1,24 @@
|
||||||
function verifyCodeFromSMS(code, phone, changeStepNumber, cb) {
|
function verifyCodeFromSMS(web3, config, sender, token, cb) {
|
||||||
$.post("/verifyCodeFromSMS", {
|
activatePair(web3, config, sender, token, function(err, txHash) {
|
||||||
"globalToken": "cba2c691-47df-41e7-bc97-a0818103ed14",
|
cb(err, txHash);
|
||||||
"code": code,
|
});
|
||||||
"phone": phone
|
}
|
||||||
}, function( data ) {
|
|
||||||
cb();
|
function activatePair(web3, config, sender, token, cb) {
|
||||||
console.log( data );
|
attachToContract(web3, config, function(err, contract) {
|
||||||
if (data.success) {
|
activatePairTX(web3, contract, sender, token, function(err, txHash) {
|
||||||
hashToAddress = data.success.message;
|
//console.log("activatePairTX:");
|
||||||
console.log(hashToAddress);
|
//console.log("result: " + txHash);
|
||||||
changeStepNumber(+1, null);
|
cb(err, txHash);
|
||||||
token.val(data.success.code);
|
});
|
||||||
swal({
|
|
||||||
title: "Success",
|
});
|
||||||
text: "Code successfully verified",
|
}
|
||||||
type: "success"
|
|
||||||
});
|
function activatePairTX(web3, contract, sender, token, cb) {
|
||||||
} else {
|
if (!web3.isConnected()) cb({code: 500, title: "Error", message: "check RPC"}, null);
|
||||||
swal({
|
|
||||||
title: "Error",
|
contract.activatePair.sendTransaction(token, {gas: 800000, from: sender}, function(err, result) {
|
||||||
text: data.error.message,
|
cb(err, result);
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
{
|
||||||
|
"environment": "dev",
|
||||||
|
"Ethereum": {
|
||||||
|
"dev": {
|
||||||
|
"contractAddress": "0x9bdf3f3d61f23f0d4eba9fff950b8facb6628fc3"
|
||||||
|
},
|
||||||
|
"live": {
|
||||||
|
"contractAddress": "0x9bdf3f3d61f23f0d4eba9fff950b8facb6628fc3"
|
||||||
|
},
|
||||||
|
"contracts": {
|
||||||
|
"ProofOfPhone": {
|
||||||
|
"bin": "0x6060604052341561000c57fe5b5b6106438061001c6000396000f30060606040523615610081576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806303679666146100835780633404fe32146100e357806371d01c73146101105780639fbebee51461015a578063b958a5e11461017e578063ceaecc84146101c8578063fe97ee8814610228575bfe5b341561008b57fe5b6100a16004808035906020019091905050610276565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156100eb57fe5b61010e6004808035906020019091908035600019169060200190919050506102b4565b005b341561011857fe5b610144600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610354565b6040518082815260200191505060405180910390f35b341561016257fe5b61017c60048080356000191690602001909190505061036c565b005b341561018657fe5b6101b2600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610537565b6040518082815260200191505060405180910390f35b34156101d057fe5b6101e66004808035906020019091905050610581565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561023057fe5b61025c600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506105b4565b604051808215151515815260200191505060405180910390f35b60006001600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690505b919050565b6040604051908101604052808381526020013373ffffffffffffffffffffffffffffffffffffffff168152506002600083600019166000191681526020019081526020016000206000820151816000015560208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055509050505b5050565b60006020528060005260406000206000915090505481565b3373ffffffffffffffffffffffffffffffffffffffff1660026000836000191660001916815260200190815260200160002060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415156103e55760006000fd5b60026000826000191660001916815260200190815260200160002060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166001600060026000856000191660001916815260200190815260200160002060000154815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600260008260001916600019168152602001908152602001600020600001546000600060026000856000191660001916815260200190815260200160002060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b50565b6000600060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490505b919050565b60016020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006000600060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415156106085760019050610612565b60009050610612565b5b9190505600a165627a7a7230582007f136df6454b733e1e101a03dccfd4fd2ad950dcba0025499b3f7a16c993ca50029",
|
||||||
|
"abi": [{"constant":true,"inputs":[{"name":"phone","type":"uint256"}],"name":"getAddressByPhone","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"phone","type":"uint256"},{"name":"codeToken","type":"bytes32"}],"name":"newToken","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"addressPhonePair","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"codeToken","type":"bytes32"}],"name":"activatePair","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"addr","type":"address"}],"name":"getPhoneByAddress","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"phoneAddressPair","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"addr","type":"address"}],"name":"hasPhone","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"}]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because one or more lines are too long
|
@ -1,4 +1,4 @@
|
||||||
//=require ZeroClipboard.js
|
|
||||||
//=require jquery.min.js
|
//=require jquery.min.js
|
||||||
|
//=require web3.js
|
||||||
|
//=require ZeroClipboard.js
|
||||||
//=require materialize.min.js
|
//=require materialize.min.js
|
||||||
//=require sweetalert.min.js
|
|
File diff suppressed because one or more lines are too long
|
@ -1,20 +1,20 @@
|
||||||
|
doctype html
|
||||||
html
|
html
|
||||||
head
|
head
|
||||||
title Proof of Phone
|
title Proof of Phone
|
||||||
link(href='https://fonts.googleapis.com/css?family=Open+Sans:400,600,700', rel='stylesheet', type='text/css').
|
link(href='https://fonts.googleapis.com/css?family=Open+Sans:400,600,700', rel='stylesheet', type='text/css').
|
||||||
link(href="img/favicon.ico",rel="icon" type="image/x-icon").
|
link(href="img/favicon.ico",rel="icon" type="image/x-icon").
|
||||||
link(rel="stylesheet",href="/css/materialize.css").
|
link(rel="stylesheet",href="./css/materialize.css").
|
||||||
link(rel="stylesheet", href="/css/header.css").
|
link(rel="stylesheet", href="./css/header.css").
|
||||||
link(rel="stylesheet", href="/css/index.css").
|
link(rel="stylesheet", href="./css/index.css").
|
||||||
link(rel="stylesheet", href="/css/loader.css").
|
link(rel="stylesheet", href="./css/loader.css").
|
||||||
link(rel="stylesheet",href="/css/sweetalert.css").
|
link(rel="stylesheet",href="./css/sweetalert2.min.css").
|
||||||
meta(property="og:site_name", content="Proof of Phone").
|
meta(property="og:site_name", content="Proof of Phone").
|
||||||
meta(property="og:title", content="Join your phone number and ethereum address.").
|
meta(property="og:title", content="Join your phone number and ethereum address.").
|
||||||
meta(property="og:description", content="Proof of phone is a smart oracle developed for the Ethereum blockchain to serve as a simple form of KYC (Know-Your-Customer).").
|
meta(property="og:description", content="Proof of phone is a smart oracle developed for the Oracles network to serve as a simple form of KYC (Know-Your-Customer).").
|
||||||
meta(property="og:url", content="https://www.proofofphone.com").
|
meta(property="og:url", content="https://www.proofofphone.com").
|
||||||
meta(property="og:image", content= "https://dl.dropboxusercontent.com/s/zzudapto6w9ch3g/proof.png").
|
meta(property="og:image", content= "https://dl.dropboxusercontent.com/s/zzudapto6w9ch3g/proof.png").
|
||||||
meta(property="fb:app_id" content="947082938740795").
|
meta(property="fb:app_id" content="947082938740795").
|
||||||
<!-- Yandex.Metrika counter --> <script type="text/javascript"> (function (d, w, c) { (w[c] = w[c] || []).push(function() { try { w.yaCounter37176425 = new Ya.Metrika({ id:37176425, clickmap:true, trackLinks:true, accurateTrackBounce:true, webvisor:true, trackHash:true }); } catch(e) { } }); var n = d.getElementsByTagName("script")[0], s = d.createElement("script"), f = function () { n.parentNode.insertBefore(s, n); }; s.type = "text/javascript"; s.async = true; s.src = "https://mc.yandex.ru/metrika/watch.js"; if (w.opera == "[object Opera]") { d.addEventListener("DOMContentLoaded", f, false); } else { f(); } })(document, window, "yandex_metrika_callbacks"); </script> <noscript><div><img src="https://mc.yandex.ru/watch/37176425" style="position:absolute; left:-9999px;" alt="" /></div></noscript> <!-- /Yandex.Metrika counter -->
|
|
||||||
body.mainBody
|
body.mainBody
|
||||||
include ./top.pug
|
include ./top.pug
|
||||||
div.middleMainContainer
|
div.middleMainContainer
|
||||||
|
@ -40,7 +40,7 @@ html
|
||||||
div.POPTitleContainer
|
div.POPTitleContainer
|
||||||
label.POPTitle Submit your phone number
|
label.POPTitle Submit your phone number
|
||||||
div.POPDescContainer.marginBottom2
|
div.POPDescContainer.marginBottom2
|
||||||
label#topDesc.POPDesc Proof of phone is a smart oracle developed for the Ethereum blockchain to serve as a simple form of KYC (Know-Your-Customer).
|
label#topDesc.POPDesc Proof of phone is a smart oracle developed for the Oracles network to serve as a simple form of KYC (Know-Your-Customer).
|
||||||
div.inputContainer
|
div.inputContainer
|
||||||
div.radioContainer.hide
|
div.radioContainer.hide
|
||||||
input(type="radio", id="radioCheckPhone", name="radioCheck", value="phone").hide
|
input(type="radio", id="radioCheckPhone", name="radioCheck", value="phone").hide
|
||||||
|
@ -70,7 +70,7 @@ html
|
||||||
div.POPTitleContainer.marginBottom1
|
div.POPTitleContainer.marginBottom1
|
||||||
label.POPTitle2 How does it work?
|
label.POPTitle2 How does it work?
|
||||||
div.POPDescContainer
|
div.POPDescContainer
|
||||||
label#bottomDesc.POPDesc Enter a phone number you'd like to join with your Ethereum address. We will send you an SMS. After verification, we will ask you to deposit a service fee of 0.1 ether to a smart contract at the address
|
label#bottomDesc.POPDesc Enter a phone number you'd like to join with your Ethereum address. We will send you an SMS. After verification, your address will be joined to your phone.
|
||||||
table#copyHashTable(cellspacing="0" cellpadding="0").copyTable.nomargin.hide
|
table#copyHashTable(cellspacing="0" cellpadding="0").copyTable.nomargin.hide
|
||||||
tbody.copyTableBody
|
tbody.copyTableBody
|
||||||
tr
|
tr
|
||||||
|
@ -88,7 +88,7 @@ html
|
||||||
table#step1CopyTable(cellspacing="0" cellpadding="0").copyTable.marginTop1
|
table#step1CopyTable(cellspacing="0" cellpadding="0").copyTable.marginTop1
|
||||||
tbody.copyTableBody
|
tbody.copyTableBody
|
||||||
tr
|
tr
|
||||||
td.copyTableCellWalletValue1= address
|
td.copyTableCellWalletValue1.hide
|
||||||
div.successContainer.hide
|
div.successContainer.hide
|
||||||
table(cellspacing="0" cellpadding="0").successTable
|
table(cellspacing="0" cellpadding="0").successTable
|
||||||
tbody.successTableBody
|
tbody.successTableBody
|
||||||
|
@ -113,4 +113,5 @@ html
|
||||||
div.loader-i.loader-i_left-bottom
|
div.loader-i.loader-i_left-bottom
|
||||||
div.loader-i.loader-i_right-bottom
|
div.loader-i.loader-i_right-bottom
|
||||||
include ./bottom.pug
|
include ./bottom.pug
|
||||||
script(type="text/javascript" src="/javascripts/application.js").
|
script(src="./javascripts/sweetalert2.min.js" type="text/javascript").
|
||||||
|
script(src="./javascripts/application.js?v=1.4" type="text/javascript").
|
Loading…
Reference in New Issue