├── .gitignore
├── LICENSE
├── README.md
├── cn
├── NEP5 TOKEN SALES.md
├── Neo Gas.md
└── images
│ └── NEP5 TOKEN SALES
│ ├── 1.png
│ ├── 2.1.png
│ ├── 2.2.png
│ ├── 2.4.png
│ └── 2.5.png
├── contributors.md
└── en
├── BulkTransfer.md
├── FAQ.md
├── NEP5TokenForExchange.md
├── Neo Gas.md
├── Neo Wallet.md
└── images
├── BulkTransfer
├── CheckTransferList.jpg
├── ChooseBulkTransfer.jpg
├── CopyToBulkTransfer.jpg
├── ExcelFile.jpg
├── InputPassword.jpg
├── NeoExplorer.jpg
├── OpenWallet.jpg
├── TransactionSuccessful.jpg
└── Transfer.jpg
├── NEP5TokenForExchange
├── 1.jpg
└── 2.jpg
└── Neo Wallet
├── Balance.jpg
├── Comparison.jpg
├── Neo Wallet.jpg
└── Transfer.jpg
/.gitignore:
--------------------------------------------------------------------------------
1 | results
2 | /.vs
3 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 Peter Lin
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Introduction to Neo
2 | Articles to explain details about Neo.
3 |
4 | ## Contents
5 |
6 | ### Basic
7 | 1.What is Neo?
8 | 2.[Neo Wallet](https://github.com/PeterLinX/Introduction-to-Neo/blob/master/en/Neo%20Wallet.md)
9 | 3.[Neo Gas](https://github.com/PeterLinX/Introduction-to-Neo/blob/master/en/Neo%20Gas.md)
10 |
11 |
12 | ### NEO-GUI
13 | [Bulk Transfer](https://github.com/PeterLinX/Introduction-to-Neo/blob/master/en/BulkTransfer.md)
14 |
15 |
16 | ### Smart Contract
17 | What is Smart Contract?
18 |
19 |
20 | ### Other
21 | [NEO FAQ](https://github.com/PeterLinX/Introduction-to-Neo/blob/master/en/FAQ.md)
22 | [NEP5 Token For Exchange](https://github.com/PeterLinX/Introduction-to-Neo/blob/master/en/NEP5TokenForExchange.md)
23 | [NEP5 Token For Exchange With Tools](https://peterlinx.github.io/Test)
--------------------------------------------------------------------------------
/cn/NEP5 TOKEN SALES.md:
--------------------------------------------------------------------------------
1 | ### 1 监视NEP5代币智能合约的脚本哈希
2 |
3 | 
4 |
5 | ### 2 参与NEP5代币发售
6 |
7 | #### 2.1 执行
8 |
9 | 
10 |
11 | #### 2.2 选择代币智能合约对应的脚本哈希
12 |
13 | 
14 |
15 | #### 2.3 选择mintTokens命令
16 |
17 | #### 2.4 选择参与代币发售的NEO数量
18 |
19 | 
20 |
21 | #### 2.5 如果相应NEP5代币智能合约顺利执行,此时钱包中会获得相应的NEP5代币
22 |
23 | 
24 |
--------------------------------------------------------------------------------
/cn/Neo Gas.md:
--------------------------------------------------------------------------------
1 | # Neo Gas
2 |
3 | ### 介绍
4 |
5 | Neo Gas共1亿份,代表了Neo区块链的使用权。Neo Gas会随着每个新区块的生成而产生,依照既定的缓慢衰减的发行速度,经历总量从0到1亿的过程,约22年达到1亿总量。只要获得Neo,Neo Gas便会在系统中按照算法自动生成。
6 |
7 |
8 |
9 | ### 基本概念
10 |
11 | 每一个Neo都有两种状态:unspent和spent。每一个Gas也有两种状态,available和unavailable。一个Neo的生命周期以转入地址起始,转出地址截止,转入时状态变为unspent,转出时状态变为spent。当Neo处于unspent状态时,所产生的Gas为unavailable状态,即不可提取。当Neo处于spent状态时,期间所产生的Gas变为available,用户可以提取。
12 |
13 |
14 |
15 | ### 数学模型
16 |
17 | t_start = Neo变为unspent状态时刻
18 |
19 | t_end = Neo变为spent状态时刻
20 |
21 | Δt_const = t_end - t_start
22 |
23 | Δt_var = t - t_start,t为当前时刻
24 |
25 | 可提取的Gas = f(neo_amount, Δt_const)
26 |
27 | 说明:由于Δt是定量,所以可提取的Gas也是一个定量。可提取Gas的大小取决于所持有的Neo数量以及两个状态的时间差。
28 |
29 | 不可提取的Gas = f(neo_amount, Δt_var)
30 |
31 | 说明:由于t是变量,所以不可提取的Gas也随时间增长而不停增长,是一个变量。
32 |
33 |
34 |
35 | ### 用途
36 |
37 | - 支付Neo区块链的记账费
38 | - 支付Neo区块链的附加服务费
39 |
40 |
41 |
42 | Edited by Peter Lin (https://github.com/PeterLinX/Introduction-to-Neo)
43 |
--------------------------------------------------------------------------------
/cn/images/NEP5 TOKEN SALES/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterLinX/Introduction-to-Neo/dcfea5d2495c835d54eeefb3e21733e4bb0c39eb/cn/images/NEP5 TOKEN SALES/1.png
--------------------------------------------------------------------------------
/cn/images/NEP5 TOKEN SALES/2.1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterLinX/Introduction-to-Neo/dcfea5d2495c835d54eeefb3e21733e4bb0c39eb/cn/images/NEP5 TOKEN SALES/2.1.png
--------------------------------------------------------------------------------
/cn/images/NEP5 TOKEN SALES/2.2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterLinX/Introduction-to-Neo/dcfea5d2495c835d54eeefb3e21733e4bb0c39eb/cn/images/NEP5 TOKEN SALES/2.2.png
--------------------------------------------------------------------------------
/cn/images/NEP5 TOKEN SALES/2.4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterLinX/Introduction-to-Neo/dcfea5d2495c835d54eeefb3e21733e4bb0c39eb/cn/images/NEP5 TOKEN SALES/2.4.png
--------------------------------------------------------------------------------
/cn/images/NEP5 TOKEN SALES/2.5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterLinX/Introduction-to-Neo/dcfea5d2495c835d54eeefb3e21733e4bb0c39eb/cn/images/NEP5 TOKEN SALES/2.5.png
--------------------------------------------------------------------------------
/contributors.md:
--------------------------------------------------------------------------------
1 | ## Contributors:
2 | [andrei](https://github.com/saltyskip)
3 | [VincentTano](https://github.com/VincentTano)
4 | [jlqe](https://github.com/jlqe)
5 | [Tom Mo](https://github.com/melodyluoxue)
6 | [melodyluoxue](https://github.com/melodyluoxue)
7 |
--------------------------------------------------------------------------------
/en/BulkTransfer.md:
--------------------------------------------------------------------------------
1 | ### 1.Open wallet
2 |
3 | 
4 |
5 | ### 2.Input your password
6 |
7 | 
8 |
9 | ### 3.Transfer
10 |
11 | 
12 |
13 | ### 4.Choose Bulk Transfer
14 |
15 | 
16 |
17 | ### 5.Copy your address and amount from excel file
18 |
19 | 
20 |
21 | ### 6.Paste address and amount into "Pay to" dialog then hit "OK"
22 |
23 | 
24 |
25 | ### 7.Check address, amount and asset in "Transfer" dialog, if everything is correct then hit "OK"
26 |
27 | 
28 |
29 | ### 8.Get transaction id
30 |
31 | 
32 |
33 | ### 9.Check your transaction in Neo Explorer
34 |
35 | 
36 |
37 |
38 |
--------------------------------------------------------------------------------
/en/FAQ.md:
--------------------------------------------------------------------------------
1 | # FAQ
2 |
3 | 1. What's the relationship between ANS and Neo?
4 |
5 | Neo is the new name of Antshares(ANS), Neo gas is the new name of Antcoins(ANC). Your ANS will become Neo automatically after the rebrand. Similarly, Your ANC will become Neo Gas as well.
6 |
7 |
8 |
9 | 2. What's the relationship between Neo and Neo Gas?
10 |
11 | Neo is the shares of the Neo blockchain system. As long as you possess Neo, Neo Gas will generated automatically in system according to generation strategy and you can claim your Neo gas as dividends. Neo stands for ownership of the system, Neo gas stands for the right to use the system.
12 |
13 |
14 |
15 | 3. Is there a transfer fee between Neo wallets?
16 |
17 | Transfer fee is 0 for now. You can transfer Neo or Neo gas without paying the transfer fee.
18 |
19 |
20 |
21 | 4. Is there a transfer fee between Neo wallet and exchange?
22 |
23 | It depends on the exchange rules. Transfer fee is 0 in Neo system for now.
24 |
25 |
26 |
27 | 5. How can I check the status of my transaction?
28 |
29 | You can check it on Neo blockchain browser, such as http://antcha.in or http://antchain.xyz.
30 |
31 |
32 |
33 | 6. How do I know I'm fully synced?
34 |
35 | You can check the height on Neo blockchain and your wallet. If the height of your wallet is the same as the browser it means your wallet is fully synced, otherwise, it's not.
36 |
37 |
38 |
39 | 7. How big is the wallet sized when fully synced?
40 |
41 | A. PC client: 1GB or so.
42 |
43 | B. Web or App client: 0.
44 |
45 |
46 |
47 | 8. How long does it take to sync my wallet?
48 |
49 | A. PC client: You can use accelerate sync package(download it from https://www.antshares.org/client/chain.acc.zip) and sync process will be 10 minutes or so. If you sync from height 0, it will take you several hours.
50 |
51 | B. Web or App client: If the network is fine, it will sync 12000 blocks per hour. If you are experiencing a long sync, it is possible that using VPN or proxy could speed up the syncing process.
52 |
53 |
54 |
55 | 9. I can't see my Neo in my wallet?
56 |
57 | 1. you can check your balance if it's right on blockchain browser of the Neo. (http://antcha.in or https://antchain.xyz/)
58 |
59 | 2. You have to wait your wallet fully synced. If your wallet is fully synced, and there is still no Neo in your wallet, then:
60 |
61 | A. PC client: Re-index your wallet.
62 |
63 | B. Web or App client: Refresh your browser(Win: Ctrl+F5, Mac: Command+shift+r).
64 |
65 |
66 |
67 | 10. For Mac user, how could I claim Neo Gas(antcoins)?
68 |
69 | For now Mac user cannot claim Neo Gas. However, Neo Gas will be generated automatically as long as you keep them in your address.
70 |
71 |
72 |
73 | 11. If I keep my Neo in exchange how could I get my Neo Gas(antcoins)?
74 |
75 | If you keep your Neo in exchange, you cannot claim Neo Gas.
76 |
77 |
78 |
79 | 12. How many Neo do I need to earn Neo gas?
80 |
81 | The smallest unit of Neo is 1. The smallest unit of Neo Gas is 0.00000001(one hundred millionth). As long as you possess Neo(at least 1 Neo), Neo gas will be generated automatically.
82 |
83 |
84 |
85 | 9. I have sent x amount of ANS/Neo to my wallet, it hasn't arrived, why?
86 |
87 | 1. Please confirm with the crypto currency exchange from which you made the transfer that the transaction was successful. If so:
88 |
89 | 2. Please check the status of your transaction/account on a block explorer (see Question 5):
90 |
91 | A. Once a transaction id has been generated and is on the block explorer, the transaction is successful and said amount has been transferred to your account. If the wallet does not display the correct balance, it is likely not synced up to date. To check if the wallet is up-to-date, see Question 6. To speed up the syncing process, see Question 8.
92 |
93 | B. If you cannot find the transaction on the explorer, please contact the party sending said Neo/ANS, for the transaction is not completed.
94 |
95 |
96 |
97 | 14. What is the difference between the electron wallet and the new NEO GUI wallet?
98 |
99 | The desktop client downloads the whole chain to your computer. The electron wallet uses an API to interact with the blockchain.
100 |
101 |
102 |
103 | 15. Is the way of storing NEO as same as Bitcoin? I am nervous about the store safety.
104 |
105 | Yes. If you are holding NEO then you are always keeping it online. Storing private keys offline means your coins are safe and can not be touched.
106 |
107 |
108 |
109 | 16. Is there a central point where I can find important dates/ delays?
110 |
111 | Reddit: https://www.reddit.com/r/NEO/
112 |
113 |
114 |
115 | 17. Can I still run the antshares wallet program(windows) or is there a new one I can download with a new name?
116 |
117 | The new desktop client is the same, only the name changed and ANS is NEO, and ANC is Neo-Gas. It is also a need to have to sync the blockchain again.
118 |
119 |
120 |
121 | 18. What is the purpose of rebranding? What new things will the rebranding bring?
122 |
123 | NEO wants to be more professional, combining digital assets, securing digital identity and allowing users to write smart contracts in multiple coding languages like Javascript, C++ and Python.
124 |
125 | NEO is the use of blockchain technology and digital identity to digitize assets, the use of smart contracts for digital assets to be self-managed, to achieve "smart economy" with a distributed network.
126 |
127 | Additional features will include NeoMessage that supports secure, encrypted peer-to-peer messaging and NeoFS, a distributed cloud storage. Smart fund investments, Online Networking and a Decentralized Exchange will also be implemented in the near future.
128 |
--------------------------------------------------------------------------------
/en/NEP5TokenForExchange.md:
--------------------------------------------------------------------------------
1 | ### 1.Deposit
2 |
3 | #### 1.1 Run neo-cli
4 | >dotnet neo-cli.dll --rpc --record-notifications
5 |
6 | #### 1.2 Receive Notifications
7 | If you need to get the notification of user's deposit, you can simply add parameter "--record-notifications". A document file called "notifications" will be generated in root path.
8 | 
9 |
10 | Notifications in every block will be recorded in a json file such as:
11 | 
12 |
13 | #### 1.3 Notifications json file
14 | For example, the content of the file "block-1503847" is:
15 | ```json
16 | [
17 | {
18 | "txid": "0x65d62a736a73c4d15dc4e4d0bfc1e4bbc4ef220e163625d770eb05577b1afdee",
19 | "contract": "0xecc6b20d3ccac1ee9ef109af5a7cdb85706b1df9",
20 | "state":
21 | {
22 | "type": "Array",
23 | "value": [
24 | {
25 | "type": "ByteArray",
26 | "value": "7472616e73666572"
27 | },
28 | {
29 | "type": "ByteArray",
30 | "value": "d336d7eb9975a29b2404fdb28185e277a4b299bc"
31 | },
32 | {
33 | "type": "ByteArray",
34 | "value": "eab336cac807707295afa7e7da2f4683237f612a"
35 | },
36 | {
37 | "type": "ByteArray",
38 | "value": "006ad42d100100"
39 | }]
40 | }
41 | }]
42 | ```
43 | There is an array of notifications in this json file. There is only one object in the array, which means only one NEP5 event triggered in the block 1503847.
44 |
45 | #### 1.4 Analyse json file
46 |
47 | (1) Filter contract by checking the value of "contract". Then you can have the right asset type.
48 | (2) Filter the function by checking the first object in "state". If the event is "transfer" then the value of the "state" will be:
49 | - An array of 4 objects: [event, from, to, amount]. It includes all information of a transaction;
50 | - The first object of the array will be the name of the "transfer" event :
51 | ```json
52 | {
53 | "type": "ByteArray",
54 | "value": "7472616e73666572"
55 | }
56 | ```
57 | (3) Filter the third object in "state". If it is the address of the exchange then you get a notification of deposit.
58 |
59 | ### 2.Query
60 |
61 | If you need to query someone's balance you should invoke 3 functions in NEP5 which are "balanceOf", "decimals" and "symbol". Then You can get the correct balance.
62 |
63 | #### 2.1 Use RPC API "invokefunction"
64 | You can use rpc api "invokefunction" by sending json to neo rpc server to query someone's balance. There're 3 parameters that you need to set up.
65 |
66 | (1) Script hash
67 | Set up the script hash of the NEP5 token you are querying. For example, you can find the script hash of RPX is : 0xecc6b20d3ccac1ee9ef109af5a7cdb85706b1df9.
68 |
69 | (2) The name of the method
70 | Set up the name of the method you are invoking. According to NEP5,if someone need to query his token balance he should invoke function "balanceOf".
71 |
72 | (3) The arguments of the method
73 | According to NEP5,there're two parameters in the main function. The first parameter is the name of methond that you need to invoke. The second parameter is an array, which is optional. If the method you are invoking need some arguments, you can passing them by constructing these parameters into an array. For example, "balanceOf" methond in NEP5 returns the token balance of the '''account'''.
74 | public static BigInteger balanceOf(byte[] account)
75 | So you need to pass the account info as an argument in the "balanceOf" method.
76 |
77 | #### 2.2 Invoke "balanceOf" function
78 |
79 | If the address of the account is AJShjraX4iMJjwVt8WYYzZyGvDMxw6Xfbe, you need to convert it into Hash160 type and construct this parameter as a json object such as:
80 | ```json
81 | {
82 | "type": "Hash160",
83 | "value": "bfc469dd56932409677278f6b7422f3e1f34481d"
84 | }
85 | ```
86 | Then you can construct the whole json message such as:
87 |
88 | Request Body:
89 |
90 | ```json
91 | {
92 | "jsonrpc": "2.0",
93 | "method": "invokefunction",
94 | "params": [
95 | "ecc6b20d3ccac1ee9ef109af5a7cdb85706b1df9",
96 | "balanceOf",
97 | [
98 | {
99 | "type": "Hash160",
100 | "value": "bfc469dd56932409677278f6b7422f3e1f34481d"
101 | }
102 | ]
103 | ],
104 | "id": 3
105 | }
106 | ```
107 |
108 | After sending the request, you will get the following response:
109 |
110 | ```json
111 | {
112 | "jsonrpc": "2.0",
113 | "id": 3,
114 | "result": {
115 | "state": "HALT, BREAK",
116 | "gas_consumed": "0.338",
117 | "stack": [
118 | {
119 | "type": "ByteArray",
120 | "value": "00e1f505"
121 | }
122 | ]
123 | }
124 | }
125 | ```
126 | It returns "00e1f505" which can be converted to interger 100000000.
127 |
128 | #### 2.3 Invoke "decimals" function
129 |
130 | Request Body:
131 |
132 | ```json
133 | {
134 | "jsonrpc": "2.0",
135 | "method": "invokefunction",
136 | "params": [
137 | "0xecc6b20d3ccac1ee9ef109af5a7cdb85706b1df9",
138 | "decimals",
139 | []
140 | ],
141 | "id": 2
142 | }
143 | ```
144 |
145 | After sending the request, you will get the following response:
146 |
147 | ```json
148 | {
149 | "jsonrpc": "2.0",
150 | "id": 2,
151 | "result": {
152 | "state": "HALT, BREAK",
153 | "gas_consumed": "0.156",
154 | "stack": [
155 | {
156 | "type": "Integer",
157 | "value": "8"
158 | }
159 | ]
160 | }
161 | }
162 | ```
163 | It returns integer 8.
164 |
165 | #### 2.4 Invoke "symbol" function
166 |
167 | Request Body:
168 |
169 | ```json
170 | {
171 | "jsonrpc": "2.0",
172 | "method": "invokefunction",
173 | "params": [
174 | "0xecc6b20d3ccac1ee9ef109af5a7cdb85706b1df9",
175 | "symbol",
176 | []
177 | ],
178 | "id": 1
179 | }
180 | ```
181 |
182 | After sending the request, you will get the following response:
183 |
184 | ```json
185 | {
186 | "jsonrpc": "2.0",
187 | "id": 1,
188 | "result": {
189 | "state": "HALT, BREAK",
190 | "gas_consumed": "0.141",
191 | "stack": [
192 | {
193 | "type": "ByteArray",
194 | "value": "525058"
195 | }
196 | ]
197 | }
198 | }
199 | ```
200 | It returns "525058" which can be converted to string "RPX".
201 |
202 | #### 2.5 Calculate the correct balance
203 | According these three important infos by invoking functions in NEP5, we can get the correct balance.
204 | The balance = 100000000/10^8 RPX = 1 RPX
205 |
206 |
207 | ### 3.Withdraw
208 |
209 | There're 3 ways for exchange to send asset to users.
210 | (1)neo-cli command: send
211 | (2)rpc method: sendtoaddress
212 | (3)rpc method: sendmany
213 |
214 | #### 3.1 neo-cli command: send
215 |
216 | `send [fee = 0]`
217 |
218 | There're 4 parameters. The first parameter is the asset ID, the second parameter is the payment address, the third parameter is the transfer amount, and the fourth parameter is the fee. (This parameter can be left empty, and the default is 0) The command needs to verify the wallet password. For example, in order to transfer 100 RPX to the address "AeSHyuirtXbfZbFik6SiBW2BEj7GK3N62b", you need to enter the following command.
219 |
220 | `send 0xecc6b20d3ccac1ee9ef109af5a7cdb85706b1df9 AeSHyuirtXbfZbFik6SiBW2BEj7GK3N62b 100`
221 |
222 | If you need to send global asset, just change the first parameter to txid. For example,
223 | The txid of NEO: 0Xc56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b
224 | The txid of GAS: 0x602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7
225 |
226 | #### 3.2 rpc method: sendtoaddress
227 |
228 | The value of key "params" is an array of at least 3 parameters.
229 |
230 | `"params":[script hash, address, amount, fee(optional), change address(optional)]`
231 |
232 | For example, if I send 1 RPX to AbP3FU3YcqBrWh72nc9deyQB99eazG9XUg , then I can construct a json below and send it to rpc server.
233 |
234 | Request Body:
235 |
236 | ```json
237 | {
238 | "jsonrpc":"2.0",
239 | "method":"sendtoaddress",
240 | "params":[
241 | "0xecc6b20d3ccac1ee9ef109af5a7cdb85706b1df9",
242 | "AbP3FU3YcqBrWh72nc9deyQB99eazG9XUg",
243 | "1",
244 | "0",
245 | "ARkJ8QcVdYL68WRvN3wj3TSvXX8CgmC73Z"
246 | ],
247 | "id":1
248 | }
249 | ```
250 |
251 | After sending the request, you will get the following response:
252 |
253 | ```json
254 | {
255 | "jsonrpc":"2.0",
256 | "id":1,
257 | "result":{
258 | "txid":"0xc6d4bf7c62fb47e0b2a6e838c3a1ca297622a1b1df7ceb2d30fa4ef8b7870700",
259 | "size":219,
260 | "type":"InvocationTransaction",
261 | "version":1,
262 | "attributes":[
263 | {
264 | "usage":"Script",
265 | "data":"5305fbbd4bd5a5e3e859b452b7897157eb20144f"
266 | }
267 | ],
268 | "vin":[
269 |
270 | ],
271 | "vout":[
272 |
273 | ],
274 | "sys_fee":"0",
275 | "net_fee":"0",
276 | "scripts":[
277 | {
278 | "invocation":"4054fbfca678737ae164ebf0e476da0c8215782bc42b67ae08cf4d8a716eeef81fcc17641e7f63893c3e685fb7eb1fb8516161c5257af41630f4508dde3afa3a8c",
279 | "verification":"210331d1feacd79b53aeeeeb9de56018eadcd07948675a50258f9e64a1204b5d58d1ac"
280 | }
281 | ],
282 | "script":"0400e1f50514d710f6f3f0bad2996a09a56d454cfc116a881bfd145305fbbd4bd5a5e3e859b452b7897157eb20144f53c1087472616e7366657267f91d6b7085db7c5aaf09f19eeec1ca3c0db2c6ecf166187b7883718089c8",
283 | "gas":"0"
284 | }
285 | }
286 | ```
287 |
288 | #### 3.3 rpc method: sendmany
289 | The value of key "params" is an array of at least 1 parameters.
290 |
291 | `"params":[[], fee(optional), change address(optional)]`
292 |
293 | For example, if I send 15.5 RPX and 0.0001 GAS to AbP3FU3YcqBrWh72nc9deyQB99eazG9XUg and the change address is also set to AbP3FU3YcqBrWh72nc9deyQB99eazG9XUg, then I can construct a json below and send it to rpc server.
294 |
295 | Request Body:
296 |
297 | ```json
298 | {
299 | "jsonrpc":"2.0",
300 | "method":"sendmany",
301 | "params":[
302 | [
303 | {
304 | "asset":"0xecc6b20d3ccac1ee9ef109af5a7cdb85706b1df9",
305 | "value":"15.5",
306 | "address":"AbP3FU3YcqBrWh72nc9deyQB99eazG9XUg"
307 | },
308 | {
309 | "asset":"0x602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7",
310 | "value":"0.0001",
311 | "address":"AbP3FU3YcqBrWh72nc9deyQB99eazG9XUg"
312 | }
313 | ],"0.00001","AbP3FU3YcqBrWh72nc9deyQB99eazG9XUg"
314 | ],
315 | "id":1
316 | }
317 | ```
318 |
319 | After sending the request, you will get the following response:
320 |
321 | ```json
322 | {
323 | "jsonrpc": "2.0",
324 | "id": 1,
325 | "result": {
326 | "txid": "0xe1351c9c9f2205a801d1b04f0df2d65fb4b1692d7d3b06cf41e0712fd1b12c9c",
327 | "size": 373,
328 | "type": "InvocationTransaction",
329 | "version": 1,
330 | "attributes": [
331 | {
332 | "usage": "Script",
333 | "data": "6d64dc9e50af8e911247436b264c8f7d791ad58c"
334 | }
335 | ],
336 | "vin": [
337 | {
338 | "txid": "0x9f0a28a912527604ab4b7d5e8b8d1a9b57631fcbab460132811ae7b6ed1ccaff",
339 | "vout": 1
340 | }
341 | ],
342 | "vout": [
343 | {
344 | "n": 0,
345 | "asset": "0x602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7",
346 | "value": "0.0001",
347 | "address": "AbP3FU3YcqBrWh72nc9deyQB99eazG9XUg"
348 | },
349 | {
350 | "n": 1,
351 | "asset": "0x602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7",
352 | "value": "0.01359",
353 | "address": "AbP3FU3YcqBrWh72nc9deyQB99eazG9XUg"
354 | }
355 | ],
356 | "sys_fee": "0",
357 | "net_fee": "0.00001",
358 | "scripts": [
359 | {
360 | "invocation": "40644ab915419dbf855a52d5c75596e80b78c8e928cc0ce91ae6afc3b75a0c31ee54efe1836f9ec232f6c42dcb3ace0bfdc688e626944fa20970a76064975eade9",
361 | "verification": "2103d4b6fc2d116855f86a483d151182f68e88e6ddd13f3f1f3631e36300aac122bfac"
362 | }
363 | ],
364 | "script": "04801f635c14d710f6f3f0bad2996a09a56d454cfc116a881bfd146d64dc9e50af8e911247436b264c8f7d791ad58c53c1087472616e7366657267f91d6b7085db7c5aaf09f19eeec1ca3c0db2c6ecf166f871fb30fc859b77",
365 | "gas": "0"
366 | }
367 | }
368 | ```
369 |
370 |
371 | ### Appendix: NEP5 Token Standard
372 |
373 | You can find the original description here: [Token Standard](https://github.com/neo-project/proposals/blob/master/nep-5.mediawiki "NEP5")
374 |
375 | In the method definitions below, we provide both the definitions of the functions as they are defined in the contract as well as the invoke parameters.
376 |
377 | This standard defines two method types:
378 |
379 | * '''(Required)''' : methods that are present on all NEP5 tokens.
380 |
381 | * '''(Optional)''' : methods that are optionally implemented on NEP5 tokens. These method types are not required for standard interfacing, and most tokens should not use them. All optional methods must be enabled if choosing to use them.
382 |
383 | #### Methods
384 |
385 | ##### totalSupply
386 |
387 | * Syntax: public static BigInteger totalSupply()
388 |
389 | * Remarks: "totalSupply" returns the total token supply deployed in the system.
390 |
391 | ##### name
392 |
393 | * Syntax: public static string name()
394 |
395 | * Remarks: "name" returns the token name.
396 |
397 |
398 | ##### symbol
399 |
400 | * Syntax: public static string symbol()
401 |
402 | * Remarks: "symbol" returns the token symbol.
403 |
404 | ##### decimals
405 |
406 | * Syntax: public static byte decimals()
407 |
408 | * Remarks: "decimals" returns the number of decimals used by the token.
409 |
410 | ##### balanceOf
411 |
412 | * Syntax: public static BigInteger balanceOf(byte[] account)
413 |
414 | * Remarks: "balanceOf" returns the token balance of the '''account'''.
415 |
416 | ##### transfer
417 |
418 | * Syntax: public static bool transfer(byte[] from, byte[] to, BigInteger amount)
419 |
420 | * Remarks: "transfer" will transfer an '''amount''' of tokens from the '''from''' account to the '''to''' account.
421 |
422 | ##### allowance ''(optional)''
423 |
424 | * Syntax: public static BigInteger allowance(byte[] from, byte[] to)
425 |
426 | * Remarks: "allowance" will return the amount of tokens that the '''to''' account can transfer from the '''from''' acount.
427 |
428 | ##### transferFrom ''(optional)''
429 |
430 | * Syntax: public static bool transferFrom(byte[] originator, byte[] from, byte[] to, BigInteger amount)
431 |
432 | * Remarks: "transferFrom" will transfer an '''amount''' from the '''from''' account to the '''to''' acount if the '''originator''' has been approved to transfer the requested '''amount'''.
433 |
434 | ##### approve ''(optional)''
435 |
436 | * Syntax: public static bool approve(byte[] originator, byte[] to, BigInteger amount)
437 |
438 | * Remarks: "approve" will approve the '''to''' account to transfer '''amount''' tokens from the '''originator''' acount.
439 |
440 | #### Events
441 |
442 | ##### transfer
443 |
444 | * Syntax: public static event Action transfer
445 |
446 | * Remarks: The "transfer" event is raised after a successful execution of the "transfer" method.
447 |
448 | #### Implementation
449 |
450 | *Woolong: https://github.com/lllwvlvwlll/Woolong
451 | *ICO Template: https://github.com/neo-project/examples/tree/master/ICO_Template
--------------------------------------------------------------------------------
/en/Neo Gas.md:
--------------------------------------------------------------------------------
1 | # Neo Gas
2 |
3 | ### Introduction of Neo Gas
4 |
5 | 1. Brief Introduction
6 | Neo Gas represents the right to use the Neo Blockchain. There will be 100 million Neo Gas in total. Neo Gas are generated along with every new block. The issuance will slow down according to a set slowly-decreasing pace, while Neo Gas will go through a generating process to grow from zero to 100 million. Once Neo is acquired, Neo Gas will be generated in the system following the algorithms.
7 |
8 | 2. Basic Concept
9 | Every Neo has two states, unspent and spent. Each Gas has two states too, which are available and unavailable. A life cycle of a Neo starts from being transferred into an address and ends with being transferred out of that address. When it is transferred in, its state becomes unspent while when it is transferred out, its state becomes spent. When Neo is at the unspent state, its generated Gas will be in unavailable state, in another word, undrawable; when Neo is at the spent state, its generated Gas will be in available state, so the users can draw them.
10 |
11 | 3. Mathematical Model
12 | t_start = the moment that Neo goes into the state of unspent
13 | t_end = the moment that Neo goes into the state of spent
14 | Δt_const = t_end - t_start
15 | Δt_var = t - t_start
16 | Available Gas = f(neo_amount, Δt_const)
17 | Unavailable Gas = f(neo_amount, Δt_var)
18 | Please note that:
19 | Δt_const is fixed, thus the available Gas is of a fixed amount too. And this amount is a function of the amount of Neo held by the user and the duration between the moments that he or she transferred this amount of Neo into and out of his or her address. The current time is a variable, so the amount of the unavailable Gas also grows through time, which means it is a variable.
20 |
21 | 4. Usage
22 | - To pay to the Neo blockchain for recording
23 | - To pay to the Neo blockchain for additional services
24 |
25 |
26 |
27 | Edited by Peter Lin (https://github.com/PeterLinX/Introduction-to-Neo)
28 |
--------------------------------------------------------------------------------
/en/Neo Wallet.md:
--------------------------------------------------------------------------------
1 | # Neo Wallet
2 |
3 | ### Introduction
4 |
5 | Imagine a physical wallet in our pocket, there are several debit cards in it, each containing a different balance. When we need to pay a bill, we will use these cards to pay it off. If the bill is expensive enough, one card alone might not have enough balance on it to pay off the entire bill. So we would use multiple cards to pay off the bill. The Neo wallet is the same as the wallet in our pocket, however, instead of cards, the Neo wallet uses addresses to hold balances.
6 |
7 | 
8 |
9 |
10 |
11 | ### Balance
12 |
13 | ##### Phyiscal Wallet Analogy
14 | Imagine a scenario where I have two cards, each containing a balance of ¥100. If I have a ¥100 bill to pay, then I can pay it off using only the first card. But if I have a ¥150 bill to pay, my first card will not be enough. I have to use both of my cards in order to pay off my bill. I have to use the full amount on both cards, and the remainder or change will be given back to me on another card of my choosing. Thus at the end of this transaction I own a card which has ¥50 worth of balance.
15 |
16 | 
17 |
18 | ##### Neo Wallet
19 |
20 | If I want to transfer my coins, Neo wallet will calculate the optimal input addresses and the corresponding amounts to make up the total sum of the coins that I need to transfer. The transaction will be constructed from the full sum of coins from each of the addresses being used for the transfer. After deducting the desired amount (which I input to transfer) to be sent from the full sum of coins, the remainder will be given back to me as change. By default Neo will choose the FIRST address of your wallet to be the default address to send the change coins.
21 |
22 | ### Transfer
23 |
24 | 
25 |
26 | For example, my wallet has 150 Neo and 110 Neo Gas, I want to transfer 120 Neo to my friend's address, but my 150 Neo are stored in 3 different addresses. The Neo wallet will calculate and make an optimal transfer strategy which is 100 Neo from address1 and 20 Neo from address3. Then a transaction will be constructed by the wallet according to this strategy and send it to the neo blockchain through the p2p network protocol. The client wallet will update the local balance in the mean time.
27 |
28 | 
29 |
30 | If this tx is verified by multiple different neo nodes, it will be recorded in the next block on the blockchain, which means that the tx has been stored and recorded in the blockchain. The wallet will be notified by the blockchain by its sync mechanism and confirm this tx.
31 |
32 | However, if this tx does not pass the verification of neo nodes for some reason, it will not be confirmed by wallet and will not be recorded in the blockchain. But since your own wallet has updated your balance to reflect the transfer, you will have to rebuild wallet index in order to remove this failed tx and rescan the blockchain to restore the balance of Neo in each of the addresses in your wallet. Since the transaction has not been recorded on the blockchain, your Neo holdings will not have changed and you still "own" them. The best way to check is to go on a blockchain explorer and search for your address. Any unconfirmed tx will not show up in the blockchain as it has not be recorded in the blocks yet.
33 |
34 | If you're curious about neo wallet's transfer strategy, please check our wallet code, and read the appendix blow. Neo block chain and wallet program is open source. You can build your own wallet by compiling the code hosted on github on your local machine. Enjoy!
35 |
36 | ### Appendix: Transfer Strategy
37 |
38 | ```c#
39 | public T MakeTransaction(T tx, UInt160 change_address = null, Fixed8 fee = default(Fixed8)) where T : Transaction
40 | {
41 | if (tx.Outputs == null) tx.Outputs = new TransactionOutput[0];
42 | if (tx.Attributes == null) tx.Attributes = new TransactionAttribute[0];
43 | fee += tx.SystemFee;
44 | var pay_total = (typeof(T) == typeof(IssueTransaction) ? new TransactionOutput[0] : tx.Outputs).GroupBy(p => p.AssetId, (k, g) => new
45 | {
46 | AssetId = k,
47 | Value = g.Sum(p => p.Value)
48 | }).ToDictionary(p => p.AssetId);
49 | if (fee > Fixed8.Zero)
50 | {
51 | if (pay_total.ContainsKey(Blockchain.SystemCoin.Hash))
52 | {
53 | pay_total[Blockchain.SystemCoin.Hash] = new
54 | {
55 | AssetId = Blockchain.SystemCoin.Hash,
56 | Value = pay_total[Blockchain.SystemCoin.Hash].Value + fee
57 | };
58 | }
59 | else
60 | {
61 | pay_total.Add(Blockchain.SystemCoin.Hash, new
62 | {
63 | AssetId = Blockchain.SystemCoin.Hash,
64 | Value = fee
65 | });
66 | }
67 | }
68 | var pay_coins = pay_total.Select(p => new
69 | {
70 | AssetId = p.Key,
71 | Unspents = FindUnspentCoins(p.Key, p.Value.Value)
72 | }).ToDictionary(p => p.AssetId);
73 | if (pay_coins.Any(p => p.Value.Unspents == null)) return null;
74 | var input_sum = pay_coins.Values.ToDictionary(p => p.AssetId, p => new
75 | {
76 | AssetId = p.AssetId,
77 | Value = p.Unspents.Sum(q => q.Output.Value)
78 | });
79 | if (change_address == null) change_address = GetChangeAddress();
80 | List outputs_new = new List(tx.Outputs);
81 | foreach (UInt256 asset_id in input_sum.Keys)
82 | {
83 | if (input_sum[asset_id].Value > pay_total[asset_id].Value)
84 | {
85 | outputs_new.Add(new TransactionOutput
86 | {
87 | AssetId = asset_id,
88 | Value = input_sum[asset_id].Value - pay_total[asset_id].Value,
89 | ScriptHash = change_address
90 | });
91 | }
92 | }
93 | tx.Inputs = pay_coins.Values.SelectMany(p => p.Unspents).Select(p => p.Reference).ToArray();
94 | tx.Outputs = outputs_new.ToArray();
95 | return tx;
96 | }
97 | ```
98 |
99 |
100 |
101 | Edited by Peter Lin (https://github.com/PeterLinX/Introduction-to-Neo)
102 |
--------------------------------------------------------------------------------
/en/images/BulkTransfer/CheckTransferList.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterLinX/Introduction-to-Neo/dcfea5d2495c835d54eeefb3e21733e4bb0c39eb/en/images/BulkTransfer/CheckTransferList.jpg
--------------------------------------------------------------------------------
/en/images/BulkTransfer/ChooseBulkTransfer.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterLinX/Introduction-to-Neo/dcfea5d2495c835d54eeefb3e21733e4bb0c39eb/en/images/BulkTransfer/ChooseBulkTransfer.jpg
--------------------------------------------------------------------------------
/en/images/BulkTransfer/CopyToBulkTransfer.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterLinX/Introduction-to-Neo/dcfea5d2495c835d54eeefb3e21733e4bb0c39eb/en/images/BulkTransfer/CopyToBulkTransfer.jpg
--------------------------------------------------------------------------------
/en/images/BulkTransfer/ExcelFile.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterLinX/Introduction-to-Neo/dcfea5d2495c835d54eeefb3e21733e4bb0c39eb/en/images/BulkTransfer/ExcelFile.jpg
--------------------------------------------------------------------------------
/en/images/BulkTransfer/InputPassword.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterLinX/Introduction-to-Neo/dcfea5d2495c835d54eeefb3e21733e4bb0c39eb/en/images/BulkTransfer/InputPassword.jpg
--------------------------------------------------------------------------------
/en/images/BulkTransfer/NeoExplorer.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterLinX/Introduction-to-Neo/dcfea5d2495c835d54eeefb3e21733e4bb0c39eb/en/images/BulkTransfer/NeoExplorer.jpg
--------------------------------------------------------------------------------
/en/images/BulkTransfer/OpenWallet.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterLinX/Introduction-to-Neo/dcfea5d2495c835d54eeefb3e21733e4bb0c39eb/en/images/BulkTransfer/OpenWallet.jpg
--------------------------------------------------------------------------------
/en/images/BulkTransfer/TransactionSuccessful.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterLinX/Introduction-to-Neo/dcfea5d2495c835d54eeefb3e21733e4bb0c39eb/en/images/BulkTransfer/TransactionSuccessful.jpg
--------------------------------------------------------------------------------
/en/images/BulkTransfer/Transfer.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterLinX/Introduction-to-Neo/dcfea5d2495c835d54eeefb3e21733e4bb0c39eb/en/images/BulkTransfer/Transfer.jpg
--------------------------------------------------------------------------------
/en/images/NEP5TokenForExchange/1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterLinX/Introduction-to-Neo/dcfea5d2495c835d54eeefb3e21733e4bb0c39eb/en/images/NEP5TokenForExchange/1.jpg
--------------------------------------------------------------------------------
/en/images/NEP5TokenForExchange/2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterLinX/Introduction-to-Neo/dcfea5d2495c835d54eeefb3e21733e4bb0c39eb/en/images/NEP5TokenForExchange/2.jpg
--------------------------------------------------------------------------------
/en/images/Neo Wallet/Balance.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterLinX/Introduction-to-Neo/dcfea5d2495c835d54eeefb3e21733e4bb0c39eb/en/images/Neo Wallet/Balance.jpg
--------------------------------------------------------------------------------
/en/images/Neo Wallet/Comparison.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterLinX/Introduction-to-Neo/dcfea5d2495c835d54eeefb3e21733e4bb0c39eb/en/images/Neo Wallet/Comparison.jpg
--------------------------------------------------------------------------------
/en/images/Neo Wallet/Neo Wallet.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterLinX/Introduction-to-Neo/dcfea5d2495c835d54eeefb3e21733e4bb0c39eb/en/images/Neo Wallet/Neo Wallet.jpg
--------------------------------------------------------------------------------
/en/images/Neo Wallet/Transfer.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterLinX/Introduction-to-Neo/dcfea5d2495c835d54eeefb3e21733e4bb0c39eb/en/images/Neo Wallet/Transfer.jpg
--------------------------------------------------------------------------------