Giter Club home page Giter Club logo

uport-proxy's Introduction

Uport-Proxy

Proxy contracts for uPort & identity systems. Proxy contracts are a way of maintaining a persistent identifier/address on a system. The Proxy contract will interact with other smart contract and it has access control that allows the user to replace and rotate private keys while maintaining a persistent identfier.

More info on Proxy contracts

Interesting Owner contracts are

OwnerWithAdmin

Owner contract with an User key that controls the proxy contract. There is also an Admin key that can unilaterally replace the User key.

OwnerWithMetaTx

Owner contract that implements Metatransactions (see the document above for more info).

IdentityFactory

The IdentityFactory creates a proxy contract with an associated controller. When a new identity is created an event is fired.

Deployed contract

The IdentityFactory is deployed on the ConsenSys testnet at the address

0xebe809bb9c515914f41e16cf500a15d31869c1e8

Example usage

You can watch the event to see when an identity has been created from a specific address.

var identityfactoryContract = web3.eth.contract([{"constant":false,"inputs":[{"name":"userKey","type":"address"},{"name":"adminKey","type":"address"}],"name":"CreateProxyWithController","outputs":[],"type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"creator","type":"address"},{"indexed":false,"name":"proxy","type":"address"},{"indexed":false,"name":"controller","type":"address"}],"name":"IdentityCreated","type":"event"}]);
var proxyContract = web3.eth.contract([{"constant":false,"inputs":[{"name":"_owner","type":"address"}],"name":"transfer","outputs":[],"type":"function"},{"constant":false,"inputs":[{"name":"addr","type":"address"}],"name":"isOwner","outputs":[{"name":"","type":"bool"}],"type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"type":"function"},{"constant":false,"inputs":[{"name":"destination","type":"address"},{"name":"value","type":"uint256"},{"name":"data","type":"bytes"}],"name":"forward","outputs":[],"type":"function"}]);
var ownerwithadminContract = web3.eth.contract([{"constant":true,"inputs":[],"name":"userKey","outputs":[{"name":"","type":"address"}],"type":"function"},{"constant":false,"inputs":[{"name":"newUserKey","type":"address"}],"name":"updateUserKey","outputs":[],"type":"function"},{"constant":true,"inputs":[],"name":"adminKey","outputs":[{"name":"","type":"address"}],"type":"function"},{"constant":false,"inputs":[{"name":"destination","type":"address"},{"name":"value","type":"uint256"},{"name":"data","type":"bytes"}],"name":"sendTx","outputs":[],"type":"function"},{"constant":true,"inputs":[],"name":"proxy","outputs":[{"name":"","type":"address"}],"type":"function"},{"constant":false,"inputs":[{"name":"newAdminKey","type":"address"}],"name":"updateAdminKey","outputs":[],"type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"type":"function"},{"inputs":[{"name":"proxyAddress","type":"address"},{"name":"_userKey","type":"address"},{"name":"_adminKey","type":"address"}],"type":"constructor"}]);

var identityFactory = identityfactoryContract.at([deployed address])

var proxyAddress;
var controllerAddress;
var creatorAddress = '0x123..';
var event = identityFactory.IdentityCreated({creator: creatorAddress}, function(error, result) {
        proxyAddress = result.args.proxy;
        controllerAddress = result.args.controller;
    });

var proxy = proxyContract.at(proxyAddress);
var controller = ownerwithadminContract.at(controllerAddress);

Testing

Tests are run using truffles framework. -install truffle and testrpc -Have testrpc running in background -Then: $ truffle test

uport-proxy's People

Contributors

coder5876 avatar oed avatar d11e9 avatar zmitton avatar pelle avatar ethers avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.