@@ -20,122 +20,12 @@ npm install
20
20
21
21
### Test
22
22
23
-
24
-
25
- ### Parity
26
- ** Parity requires Rust version 1.19.0 to build**
27
- - Linux:
28
- ``` bash
29
- $ curl https://sh.rustup.rs -sSf | sh
30
- ```
31
-
32
- Parity also requires ` gcc` , ` g++` , ` libssl-dev` /` openssl` , ` libudev-dev` and ` pkg-config` packages to be installed.
33
- - OSX:
34
- ` ` ` bash
35
- $ curl https://sh.rustup.rs -sSf | sh
36
- ` ` `
37
-
38
- # #### Download and build Parity
39
-
40
- ` ` ` bash
41
- # download Parity code
42
- $ git clone https://github.com/paritytech/parity
43
- $ cd parity
44
-
45
- # build in release mode
46
- $ cargo build --release
47
- ` ` `
48
-
49
- This will produce an executable in the ` ./target/release` subdirectory.
50
- Note: if cargo fails to parse manifest try:
51
-
52
- ` ` ` bash
53
- $ ~ /.cargo/bin/cargo build --release
54
- ` ` `
55
-
56
- # ### Start Parity
57
- To start Parity manually, just run
58
- ` ` ` bash
59
- $ ./target/release/parity
60
- ` ` `
61
- and Parity will begin syncing the Ethereum blockchain.
62
-
63
- # #### Hint
64
- Add parity to your command list:
65
- ` ` ` bash
66
- cp /target/release/parity /usr/local/bin
67
- ` ` `
68
-
69
- # # Usage
70
-
71
- You can choose of using web3 with Python and Javascript
72
-
73
- Python
74
- ----------
75
-
76
- Install web3
77
-
78
- ` pip install web3`
79
-
80
- Using Web3
81
-
82
- To use the web3 library you will need to instantiate an instance of the
83
- ` ` Web3` ` object.
84
-
85
-
86
- >>> from web3 import Web3, HTTPProvider, IPCProvider
87
-
88
- # Note that you should create only one RPCProvider per
89
- # process, as it recycles underlying TCP/IP network connections between
90
- # your process and Ethereum node
91
- >>> web3 = Web3(HTTPProvider(' http://localhost:8545' ))
92
-
93
- # or for an IPC based connection
94
- >>> web3 = Web3(IPCProvider ())
95
- >>> web3.eth.blockNumber
96
- 4000000
97
-
98
-
99
- This ` ` web3` ` instance will now allow you to interact with the Ethereum
100
- blockchain.
101
-
102
-
103
- Javascript
104
- ----------
105
-
106
- ` npm i -s web3`
107
-
108
- Create in /app folder an index.js file
109
-
110
- Use the ` web3` object directly from global namespace:
111
-
112
- ` ` ` js
113
- console.log(web3); // {eth: .., shh: ...} // it' s here!
114
- ```
115
-
116
- Set a provider (HttpProvider)
117
-
118
- ```js
119
- if (typeof web3 !== ' undefined' ) {
120
- web3 = new Web3(web3.currentProvider);
121
- } else {
122
- // set the provider you want from Web3.providers
123
- web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
124
- }
125
- ```
126
-
127
- Set a provider (HttpProvider using [HTTP Basic Authentication](https://en.wikipedia.org/wiki/Basic_access_authentication))
128
-
129
- ```js
130
- web3.setProvider(new web3.providers.HttpProvider(' http://host.url' , 0, BasicAuthUsername, BasicAuthPassword));
131
- ```
132
-
133
- There you go, now you can use it:
134
-
135
- ```js
136
- var coinbase = web3.eth.coinbase;
137
- var balance = web3.eth.getBalance(coinbase);
23
+ ``` bash
24
+ npm run test
138
25
```
139
26
140
- You can find more examples in [`example`](https://github.com/ethereum/web3.js/tree/master/example) directory.
27
+ or
141
28
29
+ ``` bash
30
+ truffle test
31
+ ```
0 commit comments