There’s been a lot of buzz in the recent year around Ethereum cryptocurrency and not without cause. Smart contracts is a new exciting concept that Ethereum introduced. What is it? Ethereum is a distributed ledger (same as bitcoin) but this ledger may contain not only accounts and balances, but also computer programs. Programs are first class citizen on Ethereum blockchain and they are not only stored on it, but they provide functions that might be called (same as you may deposit or withdraw money on the ledger’s account) and store its state on the blockchain. For software developers it would be a good analogy that Ethereum Blockchain is a something similar to a VM. There is a virtual machine with instances of objects that are stored in its memory (smart contract). Instances contain not only code that might be executed but also its state. The main difference is that the everything is stored on distributed ledger instead of RAM. This metaphor is not perfect and simplifie
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (typeof web3 !== 'undefined' && typeof Web3 !== 'undefined') { | |
web3 = new Web3(web3.currentProvider); | |
} else if (typeof Web3 !== 'undefined') { | |
console.log('No web3? You should consider trying MetaMask!') | |
web3 = new Web3(new Web3.providers.HttpProvider('http://localhost:8545')); | |
} | |
myApp.config(function ($provide) { | |
$provide.provider('ethClinet', function () { | |
this.$get = function () { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
contract Petunia is owned { | |
//constructor | |
function Petunia(address _billingAddress) | |
function getStatus(uint externalPaymentId) constant returns (string) | |
function getPrice(uint externalPaymentId) constant returns(uint) | |
function startNewPayment(uint externalPaymentId, uint price) onlyOwner |
NewerOlder