Citizenship Registry


  • var abi = [ { "constant": true, "inputs": [ { "name": "_acct", "type": "address" } ], "name": "getUserByAcct", "outputs": [ { "name": "fname", "type": "bytes32" }, { "name": "lname", "type": "bytes32" }, { "name": "picture", "type": "string" }, { "name": "eye_color", "type": "bytes32" }, { "name": "height", "type": "uint256" }, { "name": "sex", "type": "bytes32" }, { "name": "birthday", "type": "uint256" }, { "name": "acct", "type": "address" } ], "type": "function" }, { "constant": true, "inputs": [ { "name": "_account", "type": "address" } ], "name": "fname", "outputs": [ { "name": "", "type": "bytes32" } ], "type": "function" }, { "constant": false, "inputs": [ { "name": "fname", "type": "bytes32" } ], "name": "setFname", "outputs": [], "type": "function" }, { "constant": false, "inputs": [ { "name": "picture", "type": "string" } ], "name": "setPicture", "outputs": [], "type": "function" }, { "constant": true, "inputs": [ { "name": "_account", "type": "address" } ], "name": "lname", "outputs": [ { "name": "", "type": "bytes32" } ], "type": "function" }, { "constant": true, "inputs": [ { "name": "_account", "type": "address" } ], "name": "picture", "outputs": [ { "name": "", "type": "string" } ], "type": "function" }, { "constant": false, "inputs": [ { "name": "eye_color", "type": "bytes32" } ], "name": "setEyeColor", "outputs": [], "type": "function" }, { "constant": false, "inputs": [ { "name": "fname", "type": "bytes32" }, { "name": "lname", "type": "bytes32" }, { "name": "picture", "type": "string" }, { "name": "eye_color", "type": "bytes32" }, { "name": "height", "type": "uint256" }, { "name": "sex", "type": "bytes32" }, { "name": "birthday", "type": "uint256" } ], "name": "setUser", "outputs": [], "type": "function" }, { "constant": false, "inputs": [ { "name": "birthday", "type": "uint256" } ], "name": "setBirthday", "outputs": [], "type": "function" }, { "constant": true, "inputs": [ { "name": "index", "type": "uint256" } ], "name": "getUserById", "outputs": [ { "name": "fname", "type": "bytes32" }, { "name": "lname", "type": "bytes32" }, { "name": "picture", "type": "string" }, { "name": "eye_color", "type": "bytes32" }, { "name": "height", "type": "uint256" }, { "name": "sex", "type": "bytes32" }, { "name": "birthday", "type": "uint256" }, { "name": "acct", "type": "address" } ], "type": "function" }, { "constant": false, "inputs": [ { "name": "height", "type": "uint256" } ], "name": "setHeight", "outputs": [], "type": "function" }, { "constant": false, "inputs": [ { "name": "lname", "type": "bytes32" } ], "name": "setLname", "outputs": [], "type": "function" }, { "constant": false, "inputs": [ { "name": "sex", "type": "bytes32" } ], "name": "setSex", "outputs": [], "type": "function" }, { "constant": true, "inputs": [ { "name": "_account", "type": "address" } ], "name": "height", "outputs": [ { "name": "", "type": "uint256" } ], "type": "function" }, { "constant": true, "inputs": [ { "name": "_account", "type": "address" } ], "name": "birthday", "outputs": [ { "name": "", "type": "uint256" } ], "type": "function" }, { "constant": false, "inputs": [], "name": "empty", "outputs": [], "type": "function" }, { "constant": true, "inputs": [ { "name": "_account", "type": "address" } ], "name": "eye_color", "outputs": [ { "name": "", "type": "bytes32" } ], "type": "function" }, { "constant": true, "inputs": [ { "name": "_account", "type": "address" } ], "name": "sex", "outputs": [ { "name": "", "type": "bytes32" } ], "type": "function" }, { "inputs": [], "type": "constructor" }];

    var citizen = web3.exp.contract(abi).at(contract.address);

    citizen.setUser('Christopher', 'Franko', 'https://pbs.twimg.com/profile_images/665949254905556992/VUKkaUW3_400x400.jpg', 'blue', 170, 'male', 515024197,{from: exp.accounts[0], gas: 1000000});

    citizen.getUserByAcct(exp.accounts[0]);

    citizen.getUserById(1);

    Non nobis solum, sed omnibus.


  • 2
    Posts
    636
    Views
    Log in to reply


  • Citizenship contract
    functions

    set (these functions update the users record)

    setFname(bytes32 first name)
    setLname(bytes32 last name)
    setPicture(string url to img)
    setEyeColor(bytes32 )
    setHeight(uint height in cm)
    setSex(bytes32 gender)
    setBirthday(uint timestamp of birthdate)

    get (these functions get the record)

    fname(address) returns first name
    lname(address) returns last name
    picture(address) returns picture url
    eye_color(address) returns eye color
    height(address) returns height in cm
    sex(address) returns sex
    birthday(address) returns timestamp of birthday
    getUserById(uint) returns user array
    getUserByAcct(address) returns user array

    Non nobis solum, sed omnibus.


2
Posts
636
Views
Log in to reply

Internal error.

Oops! Looks like something went wrong!