Escrow contract
Contract of escrow-eth
EscrowSimple - simple contract of eth esrow without state values.
(https://github.com/JackBekket/escrow-eth/blob/master/contracts/EscrowSimple.sol)
EscrowAdvansed
(https://github.com/JackBekket/escrow-eth/blob/master/contracts/EscrowAdvansed.sol)
default seller is accounts[0] (msg.sender), default arbiter is accounts[1], default buyer is accounts[2]
— in demo.
git clone https://github.com/JackBekket/escrow-eth.git
npm install
and make sure that you have truffle installed globally.truffle migrate --reset
will deploy contract with some demodata defined in migration sript.npm run build
will build your dapp frontend with webpack builder. Make sure that you have your contract deployed.index.html
from build
directory after previous command.
var contr = EscrowAdvansed.deployed();
if you are using standart web3 Javascript-console or truffle ver 2.x
you should type:
contr.somefunction(args);
like:
contr.start(0,'bla',1,{from: web3.eth.accounts[1], value:100});
or you can call variable like:
contr.totalEscrows.call();
Cause of new break-changes in new version of truffle (http://truffleframework.com/tutorials/upgrading-from-truffle-2-to-3#contract-abstractions-deployed-is-now-thennable)
you should use the next sintax instead of above one.:
contr.then(function(res){return res.somefunction(args)});
like:
contr.then(function(res){return res.start(0,'bla',1,{from: web3.eth.accounts[1], value:100})});
and call variable like this:
contr.then(function(res){return res.totalEscrows.call()});
All functions could be found in source file (here:https://github.com/JackBekket/escrow-eth/blob/master/app/javascripts/app.js)
source file may be found here - (https://github.com/JackBekket/escrow-eth/blob/master/app/javascripts/app.js)
build file you can open in your browser and check how it works.
Frontend is a simple dapp which can be used for interaction with contract functions, but, however it is not
a complete whole dapp which can be used as standalone application.
accounts[0]
is seller, accounts[1]
is arbiter and accounts[2]
is buyer.account
.window
level of application and can be cheked and define from blockchain by any user, which allow to use it application as fully decentralized serverless application.events
,flow.js
plugin for babel and webpack.You can use this file to create markdown:
(https://github.com/JackBekket/escrow-eth/blob/master/app/index.html)
Add your css main code here:
(https://github.com/JackBekket/escrow-eth/blob/master/app/stylesheets/app.css)
or import it from main js file here:
(https://github.com/JackBekket/escrow-eth/blob/master/app/javascripts/app.js)
Also you can use any other UI modules for frontend, which can be build with webpack.
WARN - if you will use some other builders - make sure that you understand what you are doing and that web3.js is imported properly way.