Skip to content

blockchain console

amitshah edited this page May 28, 2018 · 4 revisions

Create Account

Cd demo/ node blockchain-console.js —generate -will output v3_wallet.json

find your eth dresss in the wallet.json file and Go to ropsten faucet and get 1 eth http://faucet.ropsten.be:3001/

node blockchain-console.js

Initialize

creates all contracts, outputs the GOT and NOT ERC20 tokens + Channel Manager Contract Addresses. Save these so you dont have to keep initializing on ropsten (May take 5 mins) localhost:3000/initialize

output: {got:0x5396078f1e759d74504fa6761488d5b308a47dab, not:0xf290b84fd582d6c0cf5a343b1ef41dad7bc4b01b, channelManager:0xba98a778030df9ba1103f673a28eba180b87c181 }

You don’t have to re-initialize between restarts, load state from contract intialization from prev step: http://localhost:3000/state?got=0x5396078f1e759d74504fa6761488d5b308a47dab&not=0xf290b84fd582d6c0cf5a343b1ef41dad7bc4b01b&channelManager=0xba98a778030df9ba1103f673a28eba180b87c181

Get the balances and nonce (in hex)

http://localhost:3000/

Create a new netting channel

Each account needs to ONE TIME Approve Channel Manager for GOT token address a spend amount. Set spend to 5000. http://localhost:3000/approve?spender=CHANNEL_MANAGER_ADDRESS&amount=5000&token=GOT_ADDRESS

Then you can create a channel: partner - partner eth address Timeout= time a user must wait after calling close before they can call settle() http://localhost:3000/createChannel?partner=0xf0c3043550e5259dc1c838d0ea600364d999ea18&timeout=120

Deposit into netting channel

Before you can deposit into the netting channel you created, you must approve the NOT erc20 token Spender - > netting channel address Token -> NOT address Amount -> 500 (value > deposit amount) http://localhost:3000/approve?spender=address&amount=number&token=address

Then call deposit: Channel - the netting channel address Amount - the amount of money to deposit http://localhost:3000/deposit?channel=0x26EBA5699dC63e32822672Bd13C60c9Da99940BB&amount=13