-
Notifications
You must be signed in to change notification settings - Fork 1
/
README.md.backup
33 lines (22 loc) · 888 Bytes
/
README.md.backup
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
`npm install`
`ganache-cli` - run test rpc
`ipfs-daemon` - run ipfs
`truffle migrate` - deploy contracts
`truffle console`
---
##### Truffle console interaction
Initialize account with ether
```language-javascript
current_time = Math.round(new Date() / 1000);
amt_1 = web3.toWei(1, 'ether');
```
Add products to store
```language-javascript
EcommerceStore.deployed().then(function(i) {i.addProductToStore('Leather Bracelet', 'Handmade', 'QmfZmV5TSTMfJLxkSAe5GSgycR66vnrVDY4buppadJ5qXW', 'QmfZmV5TSTMfJLxkSAe5GSgycR66vnrVDY4buppadJ5qXW', current_time, current_time + (4*86400), amt_1, 0, {gas: 1000000, from: web3.eth.accounts[1]}).then(function(f) {console.log(f)})});
```
Check for item on blockchain
```language-javascript
EcommerceStore.deployed().then(function(f) {f.getProduct.call(1).then(function(f) {console.log(f)})})
```
---
`npm run dev` - run application