Skip to content

Commit 7abcfe4

Browse files
DOC: update for testnet 3
1 parent 5acf382 commit 7abcfe4

33 files changed

+595
-2398
lines changed

docs/concepts/accounts.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
---
22
tags:
3-
- testnet 2.0
3+
- testnet 3
44
---
55

66
# Accounts
77

88
**Account** is the basic identity of an agent on the blockchain. An account is identified by its address.
99

10-
In `testnet 2.0`, accounts are divided into two types:
10+
In `testnet 3`, accounts are divided into two types:
1111

1212
- __Externally Owned Accounts (EOA)__: the address of EOA is public key of the keypair which is `ed25519_dalek` compatible.
1313
- __Contract Accounts__: contract account is created from contract deployment. The address is hash of the concatenation of a contract's bytecode and the deployer's address (which can itself be a smart contract) and nonce of the EOA that deploys the contract.

docs/concepts/block.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
tags:
3-
- testnet 2.0
3+
- testnet 3
44
---
55

66
# Block
@@ -14,21 +14,21 @@ tags:
1414

1515
- The canonical sequence or 'chain' of blocks and the raw data directly available in this sequence, for example: block hashes, transactions, and events.
1616
- The above, but further including data that is derivable from raw block data. This includes, most prominently, the world state.
17-
- The network of full nodes and light clients that maintain the correctness and consistency of the blockchain data structure.
17+
- The network of full nodes and clients that maintain the correctness and consistency of the blockchain data structure.
1818

1919
## What's in a block?
2020
---
2121

22-
- `Blockchain ID` - Id of the blockchain
23-
- `Block version number` - Version number of the block
22+
- `App ID` - Id of the blockchain
23+
- `Block Hash` - Block hash of this block
24+
- `Height` - Identifier for a height of a block on the blockchain encoded as a number
25+
- `Justify` - Quorum Certificate
26+
- `Data Hash` - Hash over Data
27+
- `Version number` - Identifier for the set of block validation rules for the blockchain
2428
- `Timestamp` - Unix timestamp (number of seconds since 1970-01-01)
25-
- `Previous block hash` - Block hash of previous block
26-
- `This block hash` - Block hash of this block
29+
- `Transaction Trie root hash` - Merkle Tree root hash of transactions
2730
- `State root hash` - Merkle Tree root hash of current world-state
28-
- `Transaction root hash` - Merkle Tree root hash of transactions
29-
- `Receipt root hash` - Merkle Tree root hash of receipts
30-
- `Proposer public key` - Public key of proposer
31-
- `Signature on the block header` - A digital Signature on the block header
31+
- `Receipt Trie root hash` - Merkle Tree root hash of receipts
3232
- `Transactions` - the transactions included in the block
3333
- `Receipts` - the execution result of transactions which are included in the block
3434

docs/concepts/consensus.md

Lines changed: 0 additions & 27 deletions
This file was deleted.

docs/concepts/gas.md

Lines changed: 67 additions & 164 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
---
22
tags:
3-
- testnet 2.0
3+
- testnet 3
44
- gas
55
---
66

77
# Gas
8-
---
98

109
**Gas**: Gas is a representation of cost incurred by computational resources per transaction. ParallelChain F assigns a cost to every transaction through gas metering.
1110

@@ -15,7 +14,7 @@ Gas costs are divided into two components:
1514
- The storage costs in bytes required to store/update data in the world state.
1615
- The compute costs for precompile functions used by developers to deploy smart contracts on ParallelChain F.
1716

18-
WASM supports a total of 513 opcodes which aid sequential, vectorized, memory, logical operations and exception handling. ParallelChain F ecosystem categorizes these opcodes on basis of their operations. Some opcode families induce non-determinism when executed. These are identified and disallowed in the ParallelChain F ecosystem with the help of a custom middleware.
17+
WASM supports over 500 opcodes which aid sequential, vectorized, memory, logical operations and exception handling. ParallelChain F ecosystem categorizes these opcodes on basis of their operations. Some opcode families induce non-determinism when executed. These are identified and disallowed in the ParallelChain F ecosystem with the help of a custom middleware.
1918

2019
## WASM Opcode Categories
2120
---
@@ -40,171 +39,75 @@ A subset of these opcodes are known to induce non-determinism when executed.Thes
4039

4140
Gas fees for each WASM opcode family are defined in terms of the total latency of the corresponding x86-64 Assembly Instructions, each opcode is translated into. For defining latency of each x86-64 Assembly Instruction, we refer to one specific CPU model from Coffee Lake Refresh, Intel's 9th Generation microprocessor family (family: 06, model: 9E). These costs have been tabulated below.
4241

43-
**Constants**
44-
45-
| Opcode | Gas Cost |
46-
|:--- |:--- |
47-
I32Const |0|
48-
I64Const |0|
42+
**Constants**
43+
44+
| Opcodes | Gas Cost |
45+
|:--- |:--- |
46+
I32Const |0|
47+
I64Const |0|
48+
49+
**Type parameteric operators**
50+
51+
| Opcodes | Gas Cost |
52+
|:--- |:--- |
53+
Drop |2|
54+
Select |3|
55+
56+
**Flow control**
57+
58+
| Opcodes | Gas Cost |
59+
|:--- |:--- |
60+
Nop, Unreachable, Else, Loop, If |0|
61+
Br, BrTable, Call, CallIndirect, Return |2|
62+
BrIf |3|
63+
64+
**Registers**
65+
66+
| Opcodes | Gas Cost |
67+
|:--- |:--- |
68+
GlobalGet, GlobalSet, LocalGet, LocalSet |3|
69+
70+
**Reference Types**
4971

50-
**Type parameteric operators**
72+
| Opcodes | Gas Cost |
73+
|:--- |:--- |
74+
RefIsNull, RefFunc, RefNull, ReturnCall, ReturnCallIndirect |2|
5175

52-
| Opcode | Gas Cost |
53-
|:--- |:--- |
54-
Drop |2|
55-
Select |3|
76+
**Exception Handling**
77+
78+
| Opcodes | Gas Cost |
79+
|:--- |:--- |
80+
CatchAll, Throw, Rethrow, Delegate |2|
81+
82+
**Bulk Memory Operations**
83+
84+
| Opcodes | Gas Cost |
85+
|:--- |:--- |
86+
ElemDrop, DataDrop |1|
87+
TableInit |2|
88+
MemoryCopy, MemoryFill, TableCopy, TableFill |3|
5689

57-
**Flow control**
90+
**Memory Operations**
91+
92+
| Opcodes | Gas Cost |
93+
|:--- |:--- |
94+
|I32Load, I64Load, I32Store, I64Store, I32Store8, I32Store16, I32Load8S, I32Load8U, I32Load16S, I32Load16U, I64Load8S, I64Load8U, I64Load16S, I64Load16U, I64Load32S, I64Load32U, I64Store8, I64Store16, I64Store32 |3|
95+
96+
**32 and 64-bit Integer Arithmetic Operations**
97+
98+
| Opcodes | Gas Cost |
99+
|:--- |:--- |
100+
|I32Add, I32Sub, I64Add, I64Sub, I64LtS, I64LtU, I64GtS, I64GtU, I64LeS, I64LeU, I64GeS, I64GeU, I32Eqz, I32Eq, I32Ne, I32LtS, I32LtU, I32GtS, I32GtU, I32LeS, I32LeU, I32GeS, I32GeU, I64Eqz, I64Eq, I64Ne, I32And, I32Or, I32Xor, I64And, I64Or, I64Xor, |1|
101+
|I32Shl, I32ShrU, I32ShrS, I32Rotl, I32Rotr, I64Shl, I64ShrU, I64ShrS, I64Rotl, I64Rotr, |2|
102+
|I32Mul, I64Mul |3|
103+
|I32DivS, I32DivU, I32RemS, I32RemU, I64DivS, I64DivU, I64RemS, I64RemU |80|
104+
|I32Clz, I64Clz |105|
58105

59-
| Opcode | Gas Cost |
60-
|:--- |:--- |
61-
Nop |0|
62-
Unreachable |0|
63-
Else |0|
64-
Loop |0|
65-
If |0|
66-
Br |2|
67-
BrTable |2|
68-
Call |2|
69-
CallIndirect |2|
70-
Return |2|
71-
BrIf |3|
72-
73-
**Registers**
74-
75-
| Opcode | Gas Cost |
76-
|:--- |:--- |
77-
GlobalGet |3|
78-
GlobalSet |3|
79-
LocalGet |3|
80-
LocalSet |3|
81-
82-
**Reference Types**
83-
84-
| Opcode | Gas Cost |
85-
|:--- |:--- |
86-
RefIsNull |2|
87-
RefFunc |2|
88-
RefNull |2|
89-
ReturnCall |2|
90-
ReturnCallIndirect |2|
91-
92-
**Exception Handling**
93-
94-
| Opcode | Gas Cost |
95-
|:--- |:--- |
96-
CatchAll |2|
97-
Throw |2|
98-
Rethrow |2|
99-
Delegate |2|
100-
101-
**Bulk Memory Operations**
102-
103-
| Opcode | Gas Cost |
104-
|:--- |:--- |
105-
ElemDrop |1|
106-
DataDrop |1|
107-
TableInit |2|
108-
MemoryCopy |3|
109-
MemoryFill |3|
110-
TableCopy |3|
111-
TableFill |3|
112-
113-
**Memory Operations**
114-
115-
| Opcode | Gas Cost |
116-
|:--- |:--- |
117-
I32Load |3|
118-
I64Load |3|
119-
I32Store |3|
120-
I64Store |3|
121-
I32Store8 |3|
122-
I32Store16 |3|
123-
I32Load8S |3|
124-
I32Load8U |3|
125-
I32Load16S |3|
126-
I32Load16U |3|
127-
I64Load8S |3|
128-
I64Load8U |3|
129-
I64Load16S |3|
130-
I64Load16U |3|
131-
I64Load32S |3|
132-
I64Load32U |3|
133-
I64Store8 |3|
134-
I64Store16 |3|
135-
I64Store32 |3|
136-
137-
**32 and 64-bit Integer Arithmetic Operations**
138-
139-
| Opcode | Gas Cost |
140-
|:--- |:--- |
141-
I32Add|1|
142-
I32Sub|1|
143-
I64Add|1|
144-
I64Sub|1|
145-
I64LtS|1|
146-
I64LtU|1|
147-
I64GtS|1|
148-
I64GtU|1|
149-
I64LeS|1|
150-
I64LeU|1|
151-
I64GeS|1|
152-
I64GeU|1|
153-
I32Eqz|1|
154-
I32Eq|1|
155-
I32Ne|1|
156-
I32LtS|1|
157-
I32LtU|1|
158-
I32GtS|1|
159-
I32GtU|1|
160-
I32LeS|1|
161-
I32LeU|1|
162-
I32GeS|1|
163-
I32GeU|1|
164-
I64Eqz|1|
165-
I64Eq|1|
166-
I64Ne|1|
167-
I32And|1|
168-
I32Or|1|
169-
I32Xor|1|
170-
I64And|1|
171-
I64Or|1|
172-
I64Xor|1|
173-
I32Shl |2|
174-
I32ShrU |2|
175-
I32ShrS |2|
176-
I32Rotl |2|
177-
I32Rotr |2|
178-
I64Shl |2|
179-
I64ShrU |2|
180-
I64ShrS |2|
181-
I64Rotl |2|
182-
I64Rotr |2|
183-
I32Mul |3|
184-
I64Mul |3|
185-
I32DivS |80|
186-
I32DivU |80|
187-
I32RemS |80|
188-
I32RemU |80|
189-
I64DivS |80|
190-
I64DivU |80|
191-
I64RemS |80|
192-
I64RemU |80|
193-
I32Clz |105|
194-
I64Clz |105|
195-
196-
**Type Casting & Truncation Operations**
197-
198-
| Opcode | Gas Cost |
199-
|:--- |:--- |
200-
I32WrapI64 |3|
201-
I32Extend8S |3|
202-
I32Extend16S |3|
203-
I64ExtendI32S |3|
204-
I64ExtendI32U |3|
205-
I64Extend8S |3|
206-
I64Extend16S |3|
207-
I64Extend32S |3|
106+
**Type Casting & Truncation Operations**
107+
108+
| Opcodes | Gas Cost |
109+
|:--- |:--- |
110+
|I32WrapI64, I32Extend8S, I32Extend16S, I64ExtendI32S, I64ExtendI32U, I64Extend8S, I64Extend16S, I64Extend32S |3|
208111

209112

210113
## Storage Gas Costs

docs/concepts/mempool.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
tags:
3-
- testnet 2.0
3+
- testnet 3
44
---
55

66
# Mempool
@@ -11,7 +11,7 @@ tags:
1111
**Mempool**: A broad term which can refer to:
1212

1313
- A component of validating and full nodes which accepts not-yet-finalized transactions for future inclusion in a block (only validating nodes can produce new blocks).
14-
- The fuzzy set of not-yet-finalized transactions included in the network's individual mempools. This set is fuzzy because individual mempools are unlikely to consistent at any given time due to network delays and and partitions.
14+
- The fuzzy set of not-yet-finalized transactions included in the network's individual mempools. This set is fuzzy because individual mempools are unlikely to be consistent at any given time due to network delays and partitions.
1515

1616
## How does mempool work?
1717
---

docs/concepts/smartcontract.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
---
22
tags:
3-
- testnet 2.0
3+
- testnet 3
44
---
55

66
# Smart Contract
77

88
## What is Smart Contract?
99
---
1010

11-
Smart contract is a program that runs on blockchain. In Parallelchain F, smart contract is an executable WASM binary and it resides in the blockchain as an account which also own its address, balance and nonce. External-owned account can make a transaction with smart contract as transaction data, which is the deployment process. A valid smart contract contains an entrypoint that can be executed when an account makes a transaction to its address.
12-
13-
**Entrypoint**: A starting point of contract execution.
11+
Contracts are the run-time programmability mechanism of ParallelChain F networks. They allow users (Account owners) to implement arbitrary logic in a global, decentralized, and Byzantine Fault Tolerant replicated state machine to support their most business-critical applications.
1412

13+
Theoretically, any WebAssembly (WASM) module that implements the Contract ABI Subprotocol can be deployed onto a ParallelChain F blockchain. Practically, however, all developers (except perhaps those who like to experiment, or that would like to stretch the limits of the system) will want to use the types and macros in this pchain-sdk to write a Contract in Rust, and the commands in pchain-compile to compile the Rust source code into WASM bytecode that can be included in a Deploy Transaction.
1514

1615
## Smart Contract Programming Model
1716
---
1817

19-
`Rust` is the primitive programing language to create a smart contract. Parallelchain F Smart Contract SDK considers the contract as a `struct` that stores fields as data in world-state, and its `impl` consists of methods representing entrypoints that can be executed.
18+
The Contract Programming Model is inspired by Object-Oriented Programming (OOP). In the Model, a Contract can be thought of as a `Rust` `struct` that controls access to persistent Storage. Accounts interact with Contracts by making EtoC Transactions calling its public methods, or just Methods for short. The following two sections elaborate on the two essential concepts of programming with the Contract Programming Model: Contract Methods, and Contract Storage.
19+
20+
See [Develop Contract](../smart_contract_sdk/develop_contract.md)

docs/concepts/transaction.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
tags:
3-
- testnet 2.0
3+
- testnet 3
44
---
55

66
# Transaction and Receipt

0 commit comments

Comments
 (0)