Update README, add forking guide

This commit is contained in:
Albert Werner 2014-06-24 23:35:25 +04:00
parent 2f44547e0d
commit 9a0a44a816

161
README
View file

@ -1,4 +1,163 @@
-= Building CryptoNote =-
== Preparation ==
1. Create an account on github.com
2. Fork https://github.com/cryptonotefoundation/cryptonote repository
3. Buy one or two Ubuntu-based dedicated servers (at least 8Gb of RAM) for seed nodes.
== First step. Give a name to your coin ==
Good name must be unique. Check uniqueness with google and mapofcoins.com or any other similar service.
Name must be specified twice:
- in file src/cryptonote_config.h - CRYPTONOTE_NAME macro
Example:
#define CRYPTONOTE_NAME "furiouscoin"
- in CMakeList.txt file - set_property(TARGET daemon PROPERTY OUTPUT_NAME "YOURCOINNAMEd")
Example:
set_property(TARGET daemon PROPERTY OUTPUT_NAME "furiouscoind")
Note: You should also change a repository name.
== Second step. Emission logic ==
1. Total money supply (src/cryptonote_config.h)
Total amount of coins to be emitted. Most of CryptoNote based coins use (uint64_t)(-1) (equals to 18446744073709551616). You can define number explicitly (for example UINT64_C(858986905600000000)).
Example:
#define MONEY_SUPPLY ((uint64_t)(-1))
2. Emission curve (src/cryptonote_config.h)
Be default CryptoNote provides emission formula with slight decrease of block reward with each block. This is different from Bitcoin where block reward halves every 4 years.
EMISSION_SPEED_FACTOR macro defines emission curve slope. This parameter is required to calulate block reward.
Example:
#define EMISSION_SPEED_FACTOR (18)
3. Difficulty target (src/cryptonote_config.h)
Difficulty target is an ideal time period between blocks. In case an average time between blocks becomes less than difficulty target, the difficulty increases. Difficulty target is measured in seconds.
Difficulty target directly influences several aspects of coin's behavior:
- transaction confirmation speed: the longer the time between the blocks is, the slower transaction confirmation is
- emission speed: the longer the time between the blocks is the slower the emission process is
- orphan rate: chains with very fast blocks have greater orphan rate
For most coins difficulty target is 60 or 120 seconds.
Example:
#define DIFFICULTY_TARGET 120
4. Block reward formula
In case you are not satisfied with CryptoNote default implementation of block reward logic you can also change it. The implementation is in src/cryptonote_core/cryptonote_basic_impl.cpp:
bool get_block_reward(size_t median_size, size_t current_block_size, uint64_t already_generated_coins, uint64_t &reward)
This function has two parts:
- basic block reward calculation
uint64_t base_reward = (MONEY_SUPPLY - already_generated_coins) >> EMISSION_SPEED_FACTOR;
- big block penalty calculation
This is the way CryptoNote protects the block chain from transaction flooding attacks and preserves opportunities for organic network growth at the same time.
Only the first part of this function is directly related to the emission logic. You can change it the way you want. See MonetaVerde and DuckNote as the examples where this function is modified.
== Third step. Networking ==
1. Default ports for P2P and RPC networking (src/cryptonote_config.h)
P2P port is used by daemons to talk to each other through P2P protocol.
RPC port is used by wallet and other programs to talk to daemon.
It's better to choose ports that aren't used by other software or coins. See known TCP ports lists:
- http://www.speedguide.net/ports.php
- http://www.networksorcery.com/enp/protocol/ip/ports00000.htm
- http://keir.net/portlist.html
Example:
#define P2P_DEFAULT_PORT 17236
#define RPC_DEFAULT_PORT 18236
2. Network identifier (src/p2p/p2p_networks.h)
This identifier is used in network packages in order not to mix two different cryptocoin networks. Change all the bytes to random values for your network:
const static boost::uuids::uuid CRYPTONOTE_NETWORK = { { 0xA1 ,0x1A, 0xA1, 0x1A , 0xA1, 0x0A , 0xA1, 0x0A, 0xA0, 0x1A, 0xA0, 0x1A, 0xA0, 0x1A, 0xA1, 0x1A} };
3. Seed nodes (src/p2p/net_node.inl)
Add ip addresses of your seed nodes to the beginning of "node_server<t_payload_net_handler>::init(const boost::program_options::variables_map& vm)" function.
Example:
ADD_HARDCODED_SEED_NODE("111.11.11.11:17236");
ADD_HARDCODED_SEED_NODE("222.22.22.22:17236");
== Fourth step. Transaction fee and related parameters ==
1. Default transaction fee (src/cryptonote_config.h)
Zero default fee can lead to transaction flooding. Transactions cheaper than the default transaction fee wouldn't be accepted by daemons. 100000 value for DEFAULT_FEE is usually enough.
Example:
#define DEFAULT_FEE 100000
2. Penalty free block size (src/cryptonote_config.h)
CryptoNote protects chain from tx flooding by reducing block reward for blocks larger than the median block size. However, this rule applies for blocks larger than CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE bytes.
Example:
#define CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE 20000
== Fifth step. Genesis block ==
Now your coin code is almost ready. You need to generate the coinbase transaction for your genesis block. Uncomment the following code in "generate_genesis_block(block& bl)" function in src/cryptonote_core/cryptonote_format_utils.cpp:
/*
account_public_address ac = boost::value_initialized<account_public_address>();
std::vector<size_t> sz;
construct_miner_tx(0, 0, 0, 0, 0, ac, bl.miner_tx); // zero fee in genesis
blobdata txb = tx_to_blob(bl.miner_tx);
std::string hex_tx_represent = string_tools::buff_to_hex_nodelimer(txb);
std::cout << "Genesis block hex: " << hex_tx_represent << std::endl;
*/
Compile and run the daemon. As soon as it prints line starting with "Genesis coinbase tx hex: " copy the hex representation of the coinbase tx and paste it into generate_genesis_block function:
Genesis coinbase tx hex: 013c01ff0001ffffffffffff0f029b2e4c0281c0b02e7c53291a94d1d0cbff8883f8024f5142ee494ffbbd08807121012cfb466857c5762cdd97e242b08b7e239ab35807f5024d4785a33d9ebdba68b0
->
std::string genesis_coinbase_tx_hex = "013c01ff0001ffffffffffff0f029b2e4c0281c0b02e7c53291a94d1d0cbff8883f8024f5142ee494ffbbd08807121012cfb466857c5762cdd97e242b08b7e239ab35807f5024d4785a33d9ebdba68b0";
Comment the coinbase tx generation code back and recompile everything again.
You coin code is ready now. Make an announcement for the potential users and enjoy!
== Building CryptoNote ==
On *nix: