Sharding
SCDO sharding infrastructure greatly improves the scalability and efficiency of SCDO Mainnet. SCDO Mainnet currently consists of four shards: each shard containing its own chain and accounts. As a kind note, here are some notable implications, of sharding, for SCDO's blockchain:
Accounts
Each user account consists of: private-key, public-key, address.
A smart contract also has an account, of which the address is revealed in the receipt of the transaction that deployed this contract. All SCDO accounts are inherently "shardful", i.e. each account can only be used in a certain shard.
Nodes
These "shardful" accounts are used in node configuration files. As implied in a node's configuration file, a node can only run on one shard: would maintain a full chain for the shard it's in, and three light chains for the other shards. A node can only mine and provide services based on the full chain.
The basic->coinbase
field in the node's configuration file must belong to the shard specified in genesis->shard
. The coinbase here is the address to receive mining reward.
Transactions
Intra-shard (sender and receiver are from the same shard) and cross-shard (sender and receiver are from different shards) transactions will be handled differently. When the sender and receiver are from the same shard, the transaction is considered completed once it is packed into a block on the shard's chain (takes approximately 20 seconds). It is, however, recommended to wait until at least 10 blocks are mined after the block containing the transaction.
When sender and receiver are from different shards, the transaction is first packed into a block on the sender's shard's chain. A corresponding debt will be generated and broadcast to the receiver's shard's chain when at least 120 blocks are mined after the transaction is packed. The transaction is considered completed once the debt is packed into a block on the receiver's shard's chain. The whole process takes about 45 minutes.
Contract
Currently, the contract account and the accounts to interact with it must be from the same shard.
For example, someone writes a contract which can refund an external address from the contract's balance. If the external address is from another shard, the refund amount will be irreversibly lost.
Last updated