Traackr
❤️
Ethereum
1.Blockchain
2. Use Case
3. Tech
1. Blockchain
&
Ethereum
Tx
Transaction
Tx
Transactions
Tx
Tx
Tx
Block
Tx
Tx
Tx
Tx
Blocks
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Blockchain
4,334,210
Transaction
Tokens
Transaction
Tokens
Transaction
Contract
Data
Transaction
Contract
Contract
Data
Smart Contract
Contract
contract Voting {
...
function voteForCandidate(bytes32 cand) {
votesReceived[cand] += 1;
}
function totalVotesFor(bytes32 cand) returns (uint8) {
return votesReceived[cand];
}
...
}
2. Use Case
2. Tech
> node web3.<function>
> geth console web3.<function>
geth
testrpc
ROPSTEN
HOMESTEAD
https://etherscan.io
http://faucet.ropsten.be:3001/
Account 1
Account 2
Account 10
...
Account:
0xd871a40290563381F6BD203B20B8013cAcc1152B
> node solc.compile()
Balance: 3Eth
solidity
Compile
Deploy
pragma solidity ^0.4.11;
contract ProjectEngagement {
// Project name
bytes32 project;
// Influencer UID
bytes32 influencerUID;
// Engagement reward
// I.e. tokens awarded for each engament point
uint8 engagementReward;
// Total reward accumulated
unit8 totalReward;
// Engagement performance. Mapping period to engagement for that period
mapping (bytes32 => uint8) public periodEngagement;
// Has the influencer aggreed to this contract
bool accepted;
/*
Constructor to initialize contract
*/
function ProjectEngagement(bytes32 project, bytes32 inf, uint8 reward) {
project = project;
influencerUID = inf;
engagementReward = reward;
}
// Update weekly performance
function updateEngagement(bytes32 period, uint8 engagement) {
periodEngagemett[period] = engagement;
totalReward += engagement * engagementReward
}
// Total rewrd accumulated so far
function totalReward() return (uint8) {
return totalReward;
}
}
QUESTIONS
Traackr ❤️ Ethereum
By David Chancogne
Traackr ❤️ Ethereum
- 849