proofofphone/README.md

56 lines
7.0 KiB
Markdown
Raw Normal View History

2016-05-17 20:02:13 -07:00
![Proof of Phone logo](https://raw.githubusercontent.com/blocknotary/proofofphone/master/logo_proof_of_phone.png)
Proof of phone is a smart oracle developed for the Etherium blockchain to serve as a simple form of KYC (Know-Your-Customer).
## Installation
1. Download zip archive
2. Unpack it
3. Go to the /web folder in terminal and install the dependencies `npm install`
4. Set **environment** in web/config.json (see config.json with placeholders below): `dev` or `live`
5. Set smart contract key points in web/config.json (see config.json with placeholders below):
* `wallet.test`, `wallet.live`
* `rpc.test`, `rpc.live`
6. Go to the root in terminal `/` and run `node deployContract.js` to deploy your smart contract into Ethereum.
7. After creation you will get the message in terminal like this:
*Contract mined! address:* **0xb713e9195f44a10383015f38774f31869053750c** *transactionHash: 0x85e85f78a4e1b40f26e491eb88b9a231b31085db11799734edc54d0285edc190*
8. Copy created smart contract address from this message and paste it to the config.json to `contractAddress.test` or `contractAddress.live` depending on your environment.
9. Set `twilio` params for sending SMS, path to mongo DB (`mongodbConnectionString`) for two-factor verification and `salt` for transaction message.
10. Go to `/web` folder in terminal and start proofofphone web application `node app.js`
### config.json with placeholders
```
{
"environment": "live/dev",
"globalToken": "cba2c691-47df-41e7-bc97-a0818103ed14",
"salt": "salt_for_message_with_hash_creating",
"mongodbConnectionString": "mongodb://user:password@path_to_database",
"sendSMS": {
"twilio": {
"phoneNumberTest": "+12345678900",
"phoneNumberLive": "+12345678900",
"accountSIDTest": "twilio_account_SID_test",
"accountSIDLive": "twilio_account_SID_live",
"authTokenTest": "twilio_auth_token_test",
"authTokenLive": "twilio_auth_token_live"
}
},
"smartContract": {
"bin": "0x606060405261074f806100126000396000f360606040523615610074576000357c0100000000000000000000000000000000000000000000000000000000900480631f83f440146101d95780634636a15914610205578063a02b9aac14610226578063b958a5e1146102aa578063f3730653146102d6578063fe97ee881461031857610074565b6101d75b6060604051908101604052806000815260200167016345785d8a0000340481526020016000368080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050815260200150600160005060003373ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060005060008201518160000160005055602082015181600101600050556040820151816002016000509080519060200190828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061017357805160ff19168380011785556101a4565b828001600101855582156101a4579182015b828111156101a3578251826000505591602001919060010190610185565b5b5090506101cf91906101b1565b808211156101cb57600081815060009055506001016101b1565b5090565b50509050505b565b005b6101ef6004808035906020019091905050610344565b6040518082815260200191505060405180910390f35b6102246004808035906020019091908035906020019091905050610388565b005b61023c6004808035906020019091905050610588565b60405180806020018281038252838181518152602001915080519060200190808383829060006004602084601f0104600f02600301f150905090810190601f16801561029c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102c06004808035906020019091905050610676565b6040518082815260200191505060405180910390f35b6102ec60048080359060200190919050506106ba565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61032e60048080359060200190919050506106f2565b6040518082815260200191505060405180910390f35b6000600160005060008373ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600050600101600050549050610383565b919050565b6060604051908101604052808281526020016000815260200160006000508054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561043a5780601f1061040f5761010080835404028352916020019161043a565b820191906000526020600020905b81548152906001019060200180831161041d57829003601f168201915b5050505050815260200150600160005060008473ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060005060008201518160000160005055602082015181600101600050556040820151816002016000509080519060200190828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106104e357805160ff1916838001178555610514565b82800160010185558215610514579182015b828111156105135782518260005055916020019190600101906104f5565b5b50905061053f9190610521565b8082111561053b5760008181506000905550600101610521565b5090565b5050905050816002600050600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908302179055505b5050565b6020604051908101604052806000815260200150600160005060008373ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000506002016000508054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106655780601f1061063a57610100808354040283529160200191610665565b820191906000526020600020905b81548152906001019060200180831161064857829003601f168201915b50505050509050610671565b919050565b6000600160005060008373ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000506000016000505490506106b5565b919050565b600260005060205280600052604060002060009150909054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006000600160005060008473ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060005060000160005054141515610740576001905061074a56610749565b6000905061074a565b5b91905056",
"ABI": [{"constant":true,"inputs":[{"name":"addr","type":"address"}],"name":"getPaymentByAddress","outputs":[{"name":"","type":"uint256"}],"type":"function"},{"constant":false,"inputs":[{"name":"addr","type":"address"},{"name":"phone","type":"uint256"}],"name":"newPhoneToAddr","outputs":[],"type":"function"},{"constant":true,"inputs":[{"name":"addr","type":"address"}],"name":"getPaymentDataByAddress","outputs":[{"name":"","type":"bytes"}],"type":"function"},{"constant":true,"inputs":[{"name":"addr","type":"address"}],"name":"getPhoneByAddress","outputs":[{"name":"","type":"uint256"}],"type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"phones","outputs":[{"name":"","type":"address"}],"type":"function"},{"constant":true,"inputs":[{"name":"addr","type":"address"}],"name":"hasPhone","outputs":[{"name":"","type":"bool"}],"type":"function"}],
"wallet": {
"test": "0x0000000000000000000000000000000000000000",
"live": "0x0000000000000000000000000000000000000000"
},
"contractAddress": {
"test": "0x0000000000000000000000000000000000000000",
"live": "0x0000000000000000000000000000000000000000"
},
"rpc": {
"test": "http://host:port",
"live": "http://host:port"
}
}
}
```