Skip to content

Commit 57678d4

Browse files
Seung Woo Kimkseo
authored andcommitted
Add page about transactions.
1 parent 40f836f commit 57678d4

File tree

5 files changed

+70
-18
lines changed

5 files changed

+70
-18
lines changed

docs/minting-sending-assets.rst renamed to docs/asset-management.rst

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ Asset Management
55
Getting Started
66
===============
77

8-
If you want to start creating assets that can be transferred amongst users, you can do it with codechain-sdk-js.
9-
If you visit this `link <https://api.codechain.io>`_, you can see an example JavaScript code.
10-
This page will guide you along on how to use codechain-sdk-js based on the example provided,
8+
If you want to start creating assets that can be transferred amongst users, you can do it with codechain-sdk-js.
9+
If you visit this `link <https://api.codechain.io>`_, you can see an example JavaScript code.
10+
This page will guide you along on how to use codechain-sdk-js based on the example provided,
1111
called “Mint 10000 Gold and send 3000 Gold using AssetMintTransaction, AssetTransferTransaction”.
1212

1313
Before starting, please install node.js by going to this `page <https://nodejs.org/en/>`_.
@@ -20,7 +20,7 @@ Then, make sure that your CodeChain RPC server is up and running. You can read a
2020

2121
Running the Sample Assets Minting Code
2222
======================================
23-
Once you have installed codechain-sdk, go to the installed directory and create a JavaScript file with the example code.
23+
Once you have installed codechain-sdk, go to the installed directory and create a JavaScript file with the example code.
2424
For simplicity, we will call this sample script sampleScript.js. To download the .js file, run:
2525
::
2626

@@ -121,14 +121,14 @@ In order to create new assets, you must create a new instance of AssetMintTransa
121121
});
122122

123123
.. note::
124-
You should note that the registrar is kept as null. This value is only filled out when there should be an overseer amongst transactions.
125-
If not null, the registrar must approve of every transaction being made with that newly created Asset. In this case, if the 10000 gold
126-
that was minted had a registrar, then every time any of those 10000 gold is involved in a transaction, the set registrar would have to
127-
sign off and approve for the transaction to be successful.
124+
You should note that the registrar is kept as null. This value is only filled out when there should be an overseer amongst transactions.
125+
If not null, the registrar must approve of every transaction being made with that newly created Asset. In this case, if the 10000 gold
126+
that was minted had a registrar, then every time any of those 10000 gold is involved in a transaction, the set registrar would have to
127+
sign off and approve for the transaction to be successful.
128128

129129
Sending/Transferring Assets
130130
===========================
131-
In this example, in order for Alice to send 3000 gold to Bob, she must first input all of her 10000 gold into a transaction.
131+
In this example, in order for Alice to send 3000 gold to Bob, she must first input all of her 10000 gold into a transaction.
132132
According to UTXO, a spender must spend all of his/her assets first, even if he/she wants to use a partial amount, and receive remainder back later.
133133
::
134134

@@ -220,18 +220,18 @@ This should return the following:
220220
null
221221

222222

223-
The results show that 7000 gold went to ``0597cf9ef3ab4c61274a31973fc46a3551f44600668efba67c4b754d9007e073`` and
223+
The results show that 7000 gold went to ``0597cf9ef3ab4c61274a31973fc46a3551f44600668efba67c4b754d9007e073`` and
224224
that 3000 gold went to ``92e9b25eed924b5b17268934798c0c70f66de38bda64b480012de9be57ac4ec1``.
225225

226226

227-
These are the values of each individual’s LockScripts that went through the blake256 hash function.
228-
If you run each individual’s LockScript under blake256 yourself, you will find that it corresponds to the rightful owners of the assets.
227+
These are the values of each individual’s LockScripts that went through the blake256 hash function.
228+
If you run each individual’s LockScript under blake256 yourself, you will find that it corresponds to the rightful owners of the assets.
229229

230230
Address Format
231231
=================================
232232
CodeChain adopted `Bitcoin's Bech32 Specification <https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki#bech32>`_. However,
233-
there are differences. Codechain does not have a seperator. Also, there are two types of addresses used in CodeChain, which are
234-
Platform Address and Asset Address. Platform Addresses are used for CCC, while Asset Addresses are used
233+
there are differences. Codechain does not have a seperator. Also, there are two types of addresses used in CodeChain, which are
234+
Platform Address and Asset Address. Platform Addresses are used for CCC, while Asset Addresses are used
235235
for mintable assets. These addresses have a human readable part, followed by code. Platform Addresses have a ``"ccc"`` tag, while
236236
Asset Addresses have a ``"cca"`` tag.
237237

docs/codechain-coin.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ CodeChain Coin
66

77
What is CodeChain Coin?
88
====================================
9-
CodeChain Coin, abbreviated as CCC, is the name of the currency used within CodeChain.
9+
CodeChain Coin, abbreviated as CCC, is the name of the currency used within CodeChain. The owernship of
10+
CodeChain Coins are marked by Platform Accounts.

docs/configuration.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Configuration
66

77
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.
88

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.
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.
1010

1111
Config File
1212
===========

docs/index.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ CodeChain is a programmable open source blockchain technology optimal for develo
1616
configuration
1717
basic-usage
1818
account-management
19+
transactions
1920
codechain-coin
20-
minting-sending-assets
21+
asset-management
2122
glossary
2223
frequently-asked-questions
23-
security
24+
security

docs/transactions.rst

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
.. _transactions:
2+
3+
##################
4+
Transactions
5+
##################
6+
7+
Gateway
8+
=================
9+
Gateways are responsible for gathering transactions and grouping them into parcels, which are then added
10+
to the blockchain. Gateways must have platform accounts that contain :ref:`codechain-coin`, since gateways
11+
are responsible for paying the transaction fees.
12+
13+
Parcel
14+
==================
15+
Parcels are a collection of transactions that are added to the blockchain. CodeChain was developed with
16+
multi-asset management in mind, coupled with the ability for the service provider to pay transaction
17+
fees for users. Transactions are collected at the gateway, which group the transactions into parcels.
18+
These gateways would be the service providers, and can pay the transaction fees for the parcels going through
19+
the respective gateways. If users want to add their transactions directly onto the blockchain without the
20+
need to go through a gateway, then they must pay their own transaction fees and create their own parcels.
21+
22+
A parcel would look something like this:
23+
::
24+
25+
pub struct Parcel {
26+
pub nonce: U256,
27+
pub fee: U256,
28+
pub network_id: u64,
29+
pub action: Action,
30+
}
31+
32+
pub enum Action {
33+
ChangeShardState {
34+
transactions: Vec<Transaction>,
35+
},
36+
Payment {
37+
receiver: Address,
38+
value: U256,
39+
},
40+
SetRegularKey {
41+
key: Public,
42+
},
43+
}
44+
45+
The fee of the parcel would determine its priority, meaning, how quickly it gets processed. In addition, there is
46+
also a minimum fee that can be set. The nonce property exists for the purpose of preventing replay attacks.
47+
48+
Validator
49+
==================
50+
(to be completed)

0 commit comments

Comments
 (0)