Skip to content

Commit 534af0c

Browse files
Seung Woo Kimkseo
authored andcommitted
Edit general layout for manual documentation
1 parent 7eb11a6 commit 534af0c

22 files changed

+455
-392
lines changed

docs/asset-management.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ Next, we create an output which gives 3000 gold to Bob, and returns 7000 gold to
161161

162162
By using Alice's signature, the 10000 Gold that was first minted can now be transferred to other users like Bob.
163163
::
164+
164165
await sendTransaction(transferTx);
165166
const transferTxInvoice = await sdk.rpc.chain.getTransactionInvoice(transferTx.hash(), 5 * 60 * 1000);
166167
if (!transferTxInvoice.success) {

docs/asset-transaction.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
.. _asset-transaction:
2+
3+
##############################
4+
Asset Transactions
5+
##############################
6+
When assets are created, there has to be transactions that change ownership of those assets. However, there is a difference between a transaction that involves
7+
newly minted assets and existing assets.
8+
9+
Asset Mint Transaction
10+
==============================
11+
When assets are newly minted, there are a couple of things you must understand. First, the asset's scheme must be defined, since the asset being created must have some
12+
sort of definition. Second, there must be an owner to this newly minted asset. Thus, when creating assets in CodeChain, an address of the owner is required. A transaction
13+
that sends fresh minted assets to a user is called the `Asset Mint Transaction <https://codechain.readthedocs.io/en/latest/asset-management.html#minting-creating-new-assets>`_.
14+
The address used for Asset Mint Transactions should follow the `Address Format <https://codechain.readthedocs.io/en/latest/asset-management.html#address-format>`_.
15+
16+
Asset Transfer Transaction
17+
==============================
18+
Once assets have been successfully minted, these assets can now be sent to other users. For instance, let's say that the initial owner of the newly minted assets
19+
is Alice. If Alice wants to send some assets to Bob, then a transaction must be created. This transaction of sending assets from one user to another is called
20+
the Asset Transfer Transaction. By using Alice's signature, assets can be send to any user, if their `Asset Address <https://codechain.readthedocs.io/en/latest/asset-management.html#asset-transfer-address-format>`_
21+
is known.

docs/blakepow.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.. _blakepow:
2+
3+
#############################
4+
BlakePoW
5+
#############################
6+
BlakePoW follows the Proof-of-Work model of Bitcoin, where a hash is calculated by adding the nonce and the block hash. It is then checked whether
7+
this added value is less than or equal to the target value over and over again. If you want an algorithm not bound to forms of processing power,
8+
please use Cuckoo.

docs/configuration.rst

Lines changed: 4 additions & 216 deletions
Original file line numberDiff line numberDiff line change
@@ -4,220 +4,8 @@
44
Configuration
55
####################
66

7-
CodeChain can be configured with either CLI options or a config file. When it comes to which options take precedence, it goes from CLI, user's own config.toml file, and config.dev.toml in that order.
7+
.. toctree::
8+
:maxdepth: 2
89

9-
CLI options can be listed by running the command ``$codechain --help``. By using the CLI options, or custom config files, the user can overwrite config.dev.toml's configurations.
10-
11-
Config File
12-
===========
13-
The default preset ``config.dev.toml`` file can be located in ``codechain/config/presets/config.dev.toml``.
14-
15-
Config files can be customized by the user and its location can be designated by using the CLI command ``--config``. Custom config files created by the user must have the proper custom path.
16-
17-
Default config.dev.toml
18-
=======================
19-
The following represents the default configuration values of ``config.dev.toml``.
20-
::
21-
22-
[codechain]
23-
quiet = false
24-
db_path = "db"
25-
keys_path = "keys"
26-
chain = "solo"
27-
secret_key = "0x0000000000000000000000000000000000000000000000000000000000000001"
28-
29-
[mining]
30-
31-
[network]
32-
disable = false
33-
port = 3485
34-
max_peers = 30
35-
min_peers = 10
36-
bootstrap_addresses = []
37-
sync = true
38-
parcel_relay = true
39-
discovery = true
40-
discovery_type = "unstructured"
41-
discovery_refresh = 60000
42-
discovery_bucket_size = 10
43-
44-
[rpc]
45-
disable = false
46-
port = 8080
47-
48-
[ipc]
49-
disable = false
50-
path = "/tmp/jsonrpc.ipc"
51-
52-
[snapshot]
53-
disable = false
54-
path = "snapshot"
55-
56-
CodeChain is set to use the Solo consensus algorithm by default. Tendermint is not suitable for solo testing purposes, since it requires a minimum of 4 users to function properly.
57-
58-
In order to test CodeChain alone, you may want to change chain to Solo. To do this, use ``--chain solo``.
59-
60-
CLI Options for CodeChain client
61-
================================
62-
``--config=[PATH]``
63-
Specify the certain config file path that you want to use to configure CodeChain to your needs.
64-
65-
``--port=[PORT]``
66-
Listen for connections on PORT. (default: 3485)
67-
68-
``--bootstrap-addresses=[BOOTSTRAP_ADDRESSES]``
69-
Bootstrap addresses to connect.
70-
71-
``--no-network``
72-
Do not open network socket.
73-
74-
``--min-peers=[NUM]``
75-
Set the minimum number of connections the user would like. (default: 10)
76-
77-
``--max-peers=[NUM]``
78-
Set the maximum number of connections the user would like. (default: 30)
79-
80-
``--instance-id=[ID]``
81-
Specify instance id for logging. Used when running multiple instances of CodeChain.
82-
83-
``--quiet``
84-
Do not show any synchronization information in the console.
85-
86-
``--chain=[CHAIN]``
87-
Set the blockchain type out of solo, solo_authority, tendermint or a path to chain spec file. (default: solo)
88-
89-
``--db-path=[PATH]``
90-
Specify the database directory path.
91-
92-
``--keys-path=[PATH]``
93-
Specify the path for JSON key files to be found.
94-
95-
``snapshot-path=[PATH]``
96-
Specify the snapshot directory path.
97-
98-
``--no-sync``
99-
Do not run block sync extension.
100-
101-
``--no-parcel-relay``
102-
Do not relay parcels.
103-
104-
``--jsonrpc-port=[PORT]``
105-
Listen for rpc connections on PORT. (default: 8080)
106-
107-
``--no-ipc``
108-
Do not run JSON-RPC over IPC service.
109-
110-
``--ipc-path=[PATH]``
111-
Specify custom path for JSON-RPC over IPC service
112-
113-
``--no-jsonrpc``
114-
Do not run jsonrpc.
115-
116-
``--secret-key=[KEY]``
117-
Secret key used by node.
118-
119-
``--author=[ADDRESS]``
120-
Specify the block's author (aka "coinbase") address for sending block rewards from
121-
sealed blocks.
122-
123-
``--engine-signer=[ADDRESS]``
124-
Specify the address which should be used to sign consensus messages and
125-
issue blocks.
126-
127-
``--mem-pool-mem-limit=[MB]``
128-
Maximum amount of memory that can be used by the mem pool. Setting this parameter to 0 disables limiting.
129-
130-
``--mem-pool-size=[LIMIT]``
131-
Maximum amount of parcels in the queue (waiting to be included in next block).
132-
133-
``notify-work=[URLS]``
134-
URLs to which work package notifications are pushed.
135-
136-
``force-sealing``
137-
Force the node to author new blocks as if it were always sealing/mining.
138-
139-
``reseal-min-period=[MS]``
140-
Specify the minimum time between reseals from incoming parcels. MS is time measured in milliseconds.
141-
142-
``reseal-max-period=[MS]``
143-
Specify the maximum time since last block to enable force-sealing. MS is time measured in milliseconds.
144-
145-
``work-queue-size=[ITEMS]``
146-
Specify the number of historical work packages which are kept cached lest a solution is found for them later. High values take more memory but result in fewer unusable solutions.
147-
148-
``--no-discovery``
149-
Do not use discovery. No automated peer finding.
150-
151-
``--discovery="kademlia" | "unstructured"``
152-
Decides which p2p discovery extension to use. Options are `kademlia <https://github.com/CodeChain-io/codechain/wiki/Kademlia-Extension>`_ and unstructured.
153-
In a testing environment, an unstructured p2p network is desirable because it is
154-
more than sufficient when there are a few users.
155-
(default: unstructured)
156-
157-
``--discovery-bucket-size=[NUM]``
158-
Bucket size for discovery. Choose how many addresses to exchange at a time
159-
during discovery.
160-
161-
``--discovery-refresh=[ms]``
162-
Refresh timeout of discovery (ms). It may conflict with:`` --no-discovery``.
163-
164-
``--no-snapshot``
165-
Disable snapshots
166-
167-
Logging
168-
=======
169-
For logging, run the following to configure:
170-
``$ RUST_LOG=<level> codechain``
171-
172-
Log Levels
173-
----------
174-
CodeChain currently offers five different ``<level>``. They are error, warn, info, debug, and trace.
175-
176-
For example, the log level will be set to debug, if you run the following:
177-
178-
``$ RUST_LOG="debug" codechain``
179-
180-
* The **error** level represents an event where something can be dangerous, but can still run. In the case in which it cannot run anymore, it must crash ASAP instead of logging.
181-
182-
* The **warn** level represents an event which can be potentially dangerous.
183-
184-
* The **info** level represents an event which is not dangerous, but can be useful information for users.
185-
186-
* The **debug** level represents an event that is useful for developers, but not for users.
187-
188-
* The **trace** level is used for tracing.
189-
190-
Log Targets
191-
-----------
192-
193-
Log levels can be set differently for each log targets. For example, you can run the following to set ``tx``'s log level as ``trace`` and ``parcel``'s
194-
log level as ``info`` with the following code:
195-
196-
``$ RUST_LOG="tx=trace,parcel=info" codechain``
197-
198-
The possible log targets are as follows:
199-
::
200-
201-
"blockchain"
202-
"client"
203-
"discovery"
204-
"engine"
205-
"external_parcel"
206-
"io"
207-
"mem_pool"
208-
"miner"
209-
"net"
210-
"netapi"
211-
"own_parcel"
212-
"poa"
213-
"shutdown"
214-
"snapshot"
215-
"solo_authoirty"
216-
"spec"
217-
"state"
218-
"state_db"
219-
"stratum"
220-
"sync"
221-
"test_script"
222-
"trie"
223-
"tx"
10+
how-to-configure
11+
logging

docs/consensus-algorithms.rst

Lines changed: 9 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -6,52 +6,12 @@ Consensus Algorithms
66
Currently there are five consensus algorithms being used in CodeChain. Conensus algorithms each have their strengths,
77
which is why a variety is being offered.
88

9-
Solo
10-
==========================
11-
Used for testing purposes only when there is only one node in the entire network. Solo is not a consensus algorithm.
12-
13-
Tendermint
14-
==========================
15-
`Tendermint <https://tendermint.com/>`_ is a Proof-of-Stake algorithm which is designed to tolerate machines that fail in arbitrary ways,
16-
which is also known as Byzantine fault tolerance(BFT). Tendermint claims that even if 1/3 of the machines fail, it will still operate properly,
17-
offering a secure and consistent system.
18-
19-
BlakePoW
20-
==========================
21-
BlakePoW follows the Proof-of-Work model of Bitcoin, where a hash is calculated by adding the nonce and the block hash. It is then checked whether
22-
this added value is less than or equal to the target value over and over again. If you want an algorithm not bound to forms of processing power,
23-
please use Cuckoo.
24-
25-
Cuckoo
26-
==========================
27-
Cuckoo aims to be resistant to Bitcoin style hardware arms-races by making its algorithm memory bound. Thus, solution times should be bound to
28-
memory bandwidth instead of other forms of raw processing power. As a result, Cuckoo should be a viable solution for running on most commodity
29-
hardware, and require far less energy than other forms of PoW algorithms that are bound to GPU, CPU or ASIC.
30-
31-
PoW Mining Difficulty
32-
==========================
33-
Currently, the mining difficulty is adjusted depending on the timestamp differences of the blocks. If the difference is less than 10 seconds,
34-
the difficulty is adjusted upwards. If the timestamp difference is between 10 to 19 seconds, the difficulty is left unchanged. If greater
35-
than or equal to 20 seconds, the difficulty is adjusted downwards proportional to the timestamp difference.
36-
37-
RPC API
38-
==========================
39-
For examples, please click `here <https://github.com/CodeChain-io/codechain/blob/master/spec/JSON-RPC.md#miner_getwork>`_.
40-
41-
``miner_getWork``
42-
43-
Returns the hash of the current block, the score and the block number.
44-
45-
Params: No parameters
46-
47-
Return Type: work object
48-
49-
``miner_submitWork``
50-
51-
Used for submitting a proof-of-work solution.
52-
53-
Params:
54-
55-
powHash: string
56-
seal: Array of string
57-
Return Type: bool
9+
.. toctree::
10+
:maxdepth: 2
11+
12+
solo
13+
tendermint
14+
blakepow
15+
cuckoo
16+
pow-mining-difficulty
17+
rpc-api

docs/cuckoo.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.. _cuckoo:
2+
3+
#############################
4+
Cuckoo
5+
#############################
6+
Cuckoo aims to be resistant to Bitcoin style hardware arms-races by making its algorithm memory bound. Thus, solution times should be bound to
7+
memory bandwidth instead of other forms of raw processing power. As a result, Cuckoo should be a viable solution for running on most commodity
8+
hardware, and require far less energy than other forms of PoW algorithms that are bound to GPU, CPU or ASIC.

docs/gateway.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.. _gateway:
2+
3+
#####################
4+
Gateway
5+
#####################
6+
Gateways are responsible for gathering transactions and grouping them into parcels, which are then added
7+
to the blockchain. Gateways must have platform accounts that contain :ref:`codechain-coin`, since gateways
8+
are responsible for paying the transaction fees.

0 commit comments

Comments
 (0)