Skip to content

Commit d444ed2

Browse files
author
Thomas Wiesner
committed
updated for truffle 4
1 parent be82193 commit d444ed2

File tree

4 files changed

+16
-143
lines changed

4 files changed

+16
-143
lines changed

README.md

+10-139
Original file line numberDiff line numberDiff line change
@@ -11,90 +11,28 @@ The scope of the Code is to show what you can achieve in Solidity, Ethereum, Web
1111
* Listen and react to specific events
1212
* Write Test Cases
1313
* Deploy the DApp
14-
* Work with MIST
14+
* Work with Remix
15+
* Work with MetaMask
1516
* Work with Truffle and WebPack
1617

1718
## Install Instructions
1819

19-
Developing for Ethereum is sometimes frustrating, because things change at fast pace. If something does not work as described here, please:
20+
### Geth
21+
Download geth for your platform from https://geth.ethereum.org/downloads/
2022

21-
### Update October 2017
22-
On all platforms it should be easier to install truffle now. The truffle team has put together a package that doesn't need compilation:
23-
```
24-
npm install -g truffle
25-
npm install -g ethereumjs-testrpc
26-
```
27-
28-
All code should be updated to the Solidity Version 0.4.15 and works with Truffle 3.4.11.
29-
30-
### Update End
31-
32-
### General
33-
34-
1. try a google search as you are 100% not alone with your problem
35-
2. inform the instructors of the course so they can correct the problem
36-
3. if you have the time, it would be awesome if you'd make a pull-request here
37-
38-
### Windows
39-
40-
~~1. Download Python:~~
41-
https://www.python.org/downloads/release/python-2712/
42-
43-
~~2. .Net Packages~~
44-
https://www.microsoft.com/en-US/download/details.aspx?id=49982
45-
46-
https://www.microsoft.com/en-us/download/details.aspx?id=30653
47-
48-
~~3. SSL~~
49-
https://slproweb.com/products/Win32OpenSSL.html
50-
51-
~~4. and eventually you also need the Visual Studio, because of the C++ Compiler:~~
52-
https://www.visualstudio.com/vs/
53-
54-
After downloading the Visual Studio make sure to open one time _a new c++ project_.
55-
56-
5. Install the Git-Bash as it comes with a mingw:
57-
https://git-scm.com/downloads
58-
59-
6. Install NodeJS and the Node Package Manager (NPM)
60-
https://nodejs.org/en/download/
23+
#### Geth Mac-OS:
24+
Copy the "geth" file within the download zip into the following folder:
6125

62-
7. Install Truffle and TestRPC
63-
npm install -g truffle
64-
npm install -g ethereumjs-testrpc
26+
"/usr/local/bin"
6527

66-
### Ubuntu
28+
### Truffle
29+
Install NodeJS first: https://nodejs.org/en/
6730

68-
~~1. Install necessary packages:~~
69-
```
70-
sudo apt-get update && sudo apt-get upgrade
71-
sudo apt-get install curl git vim build-essential
72-
```
73-
74-
2. Install NodeJS and NPM
75-
```
76-
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
77-
sudo apt-get install -y nodejs
78-
sudo npm install -g express
79-
```
80-
81-
3. Install Truffle and TestRPC
82-
npm install -g truffle
83-
npm install -g ethereumjs-testrpc
84-
### Mac
85-
86-
1. Install node
87-
https://nodejs.org/en/download/
88-
89-
~~2. Install a c++ compiler which typically comes with xCode.~~
90-
91-
3. Install truffle from the command line **as root/systems administrator**
31+
Then in the Terminal/PowerShell install Truffle:
9232
```
9333
npm install -g truffle
94-
npm install -g ethereumjs-testrpc
9534
```
9635

97-
9836
## Known Issues
9937

10038
### Fatal: Error starting protocol stack: listen udp :30303: bind: address already in use
@@ -110,72 +48,5 @@ For MIST:
11048
/Applications/Mist.app/Contents/MacOS/Mist --rpc <path to chaindata>/geth.ipc
11149
```
11250

113-
### Error when running truffle test/migrate
114-
115-
If something like this pops up:
116-
```
117-
dependency_path = source.resolve_dependency_path(import_path, dependency_path);
118-
```
119-
120-
or
121-
122-
```
123-
/usr/lib/node_modules/truffle/node_modules/truffle-compile/profiler.js:120
124-
if (ancestors.length > 0) {
125-
^
126-
127-
TypeError: Cannot read property 'length' of undefined
128-
at walk_from (/usr/lib/node_modules/truffle/node_modules/truffle-compile/profiler.js:120:22)
129-
130-
```
131-
132-
then try to install truffle 3.1.9:
133-
134-
```
135-
npm install -g [email protected]
136-
```
137-
138-
### Error when installing truffle
139-
140-
Something like
141-
142-
`... receive errors including "MSBUILD : error MSB3428: Could not load the Visual C++ component "VCBuild.exe".`
143-
144-
or
145-
146-
`... node_modules\truffle\node_modules\sha3\build\sha3.vcxproj(20,3): error MSB4019: The imported project "C:\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.". `
147-
148-
When you have installed Visual Studio, make sure you have opened a c++ project once.
149-
150-
Then try `npm config set msvs_version 2015 --global` and in addition you can try to install the ms-build tools:
151-
```
152-
npm install --global --production windows-build-tools
153-
```
154-
155-
### Geth Attach
156-
157-
158-
On Windows its simply possible to do a `geth attach`, but on MacOS it seems that you need to provide the actual ipc file. `geth --datadir /media/user/sdcard/chaindata --ipcpath $HOME/.ethereum/geth.ipc console` which is a problem posed here: http://ethereum.stackexchange.com/questions/4472/port-30303-error-in-mist-when-i-run-geth-with-a-different-datadir
159-
160-
161-
### Private Network
162-
The way the private network is initialized changed in the past months and seems to keep changing. For better information on it, it is advised to directly see the correct instructions on:
163-
https://github.com/ethereum/go-ethereum
164-
165-
_Usually_ it should work with:
166-
```
167-
geth init path/to/genesis.json --datadir=/path/to/some/folder
168-
```
169-
170-
171-
### Solidity Compilation Errors/Warnings
172-
Solidity is in active maintenance and things change _all the time_! The code throughout the course was written for the current version (at the time this Readme was written) 0.4.8.
173-
174-
Any Solidity Program can be "forced" to use another compiler version (older one) by using as _first line in your program_
175-
`pragma solidity ^0.4.0;` for version 0.4.0, change it to whatever version you might need.
176-
177-
The code here is updated to work with solidity 0.4.15.
178-
179-
18051
## Contact
18152
If you run into any problems, don't hesitate to contact us on the course-forum at any time. If you use the forum-search function, there is a high chance that you find the answer to your problem already.

s08/l02/index.html

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
}
1414

1515
function getBalance() {
16-
document.getElementById("myBalance").innerText = web3.fromWei(web3.eth.getBalance(web3.eth.accounts[0]), "ether");
16+
web3.eth.getBalance(web3.eth.accounts[0], function(error, balance) {
17+
document.getElementById("myBalance").innerText = web3.fromWei(balance, "ether");
18+
});
1719
}
1820
</script>
1921
</head>

s11/frontend/app/javascripts/app.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,9 @@ window.addEventListener('load', function() {
124124
// Use Mist/MetaMask's provider
125125
window.web3 = new Web3(web3.currentProvider);
126126
} else {
127-
console.warn("No web3 detected. Falling back to http://localhost:8545. You should remove this fallback when you deploy live, as it's inherently insecure. Consider switching to Metamask for development. More info here: http://truffleframework.com/tutorials/truffle-and-metamask");
127+
console.warn("No web3 detected. Falling back to http://localhost:9545. You should remove this fallback when you deploy live, as it's inherently insecure. Consider switching to Metamask for development. More info here: http://truffleframework.com/tutorials/truffle-and-metamask");
128128
// fallback - use your fallback strategy (local node / hosted node + in-dapp id mgmt / fail)
129-
window.web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
129+
window.web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:9545"));
130130
}
131131

132132
App.start();

s11/frontend/truffle.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ require('babel-register')
33

44
module.exports = {
55
networks: {
6-
development: {
6+
mynetwork: {
77
host: 'localhost',
88
port: 8545,
99
network_id: '*' // Match any network id

0 commit comments

Comments
 (0)