Download the last distribution of the node. We will produce an install. When requesting connection to existing networks, we answer the question negatively.
Prepare the configuration files of the noda, network and chain for each node
Prepare certificates for both nodes
root@node-0:~# cellframe-node-tool cert create my-testnet.pvt.0 sig_dil
root@node-0:~# cellframe-node-tool cert create_cert_pkey my-testnet.pvt.0 my-testnet.0
root@node-1:~# cellframe-node-tool cert create my-testnet.pvt.1 sig_dil
root@node-1:~# cellframe-node-tool cert create_cert_pkey my-testnet.pvt.1 my-testnet.1
/Opt/Cellframe-Node/Share/Ca
root@node-0:~# cellframe-node-cli version
root@node-0:~# cellframe-node-cli node dump -net my-testnet
root@node-1:~# cellframe-node-cli node dump -net my-testnet
A nodelist is formed automatically if the IP address in the config is indicated. You can also add the addresses of nodes using the command:
root@node-0:~# cellframe-node-cli node add -net my-testnet -addr DDDD::0000::0000::0000 -cell 0x0000000000000001 -ipv4 192.168.0.1 -port 8079
root@node-0:~# cellframe-node-cli net -net my-testnet go online
root@node-1:~# cellframe-node-cli net -net my-testnet go online
root@node-0:~# cellframe-node-cli net -net my-testnet get status
root@node-1:~# cellframe-node-cli net -net my-testnet get status
root@node-0:~# cellframe-node-cli wallet new -w my_wallet_0
Wallet 'my_wallet_0' (type=sig_dil) successfully created
root@node-1:~# cellframe-node-cli wallet new -w my_wallet_1
Wallet 'my_wallet_1' (type=sig_dil) successfully created
Token declaration operations, executing on node client (token_decl command) will be approved manually.
In order for the first event in the blockchain to be called valid, it is necessary to perform its processing node in the Seed_mode
mode. To do this, on the zero node in the configuration file, we reaches the next line and change its value.Restore the node.
We will make a declaration of token in the zero node. The Datum of the Declaration is placed in a membrane and Noda tells us his hash:
root@node-0:~# cellframe-node-cli token_decl -net my-testnet -chain zerochain -token myTKN -decimals 18 -signs_total 2 -signs_emission 2 -certs my-testnet.pvt.0 -type CF20 -total_supply 0
Datum 0x87EBA6876D115C7B50E61CD6AB594582E92E1704DDCA07B1CB8FD88EBCED6D18 with 256bit token myTKN is placed in datum pool
IMPORTANT Since we create a network in which two nodes will participate, it is advisable to use the token signature mechanism with several certificates. The parameter is responsible for this - -signs_emission
.
0x87EBA6876D115C7B50E61CD6AB594582E1704DDCA07B1CB88FD6D18
).The token declaration receives another signature, the node reports that the Datum is replaced, withdrawing it with a new hash.root@node-1:~# cellframe-node-cli token_decl_sign -datum 0x87EBA6876D115C7B50E61CD6AB594582E92E1704DDCA07B1CB8FD88EBCED6D18 -net my-testnet -certs my-testnet.pvt.1
datum 0xED5E90AE9FD84331DCC42437BA5C85DD68246E803AC5D52B18F423787E3B7CDA is replacing the 0x87EBA6876D115C7B50E61CD6AB594582E92E1704DDCA07B1CB8FD88EBCED6D18 in datum pool
Mempool_List
command should already see the DATUM of the declaration with two signatures. After that, we will carry out the processing of the membrane on the zero node, indicating the last hesh received.root@node-0:~# cellframe-node-cli mempool_proc -net my-testnet -chain zerochain -datum 0xED5E90AE9FD84331DCC42437BA5C85DD68246E803AC5D52B18F423787E3B7CDA
hash 0xED5E90AE9FD84331DCC42437BA5C85DD68246E803AC5D52B18F423787E3B7CDA: type_id=DATUM_TOKEN_DECL ts_create=Tue Sep 6 2022 10:15:07
data_size=6916
Datum processed well. Removed datum from mempool.
[10/06/22-08:57:55] [INF] [dap_chain_cs_dag] Event 0x1AD11AC686DE73E07429E3B79FB6F536DA5A46CAEF755F8A53B54FC36C0376F4 placed in the new forming round
[10/06/22-08:58:01] [ * ] [dap_chain_cs_dag_poa] Run timer for 30 sec for round ID 1
[10/06/22-08:58:28] [ * ] [dap_chain_cs_dag] Accepting genesis event
[10/06/22-08:58:28] [ * ] [dap_chain_global_db_mdbx] DB context for the group 'local.ledger-cache.my-testnet.tokens'
has been created
[10/06/22-08:58:28] [INF] [dap_chain_cell] Create chain cell
[10/06/22-08:58:28] [ * ] [dap_chain_cell] Initialized file storage for cell 0x0000000000000000 ( 0.dchaincell )
[10/06/22-08:58:31] [ * ] [dap_chain_cs_dag_poa] Event 0x77A5058DD364E32CFA674B721B0A419789839275A36B31F5E16CA30C23158BE5 from round 1 not added in chain
root@node-0:~# cellframe-node-cli dag event list -net my-testnet -chain zerochain -from events
0x77A5058DD364E32CFA674B721B0A419789839275A36B31F5E16CA30C23158BE5: ts_create=Thu Oct 6 08:59:23 2022
my-testnet.zerochain have total 1 events :
Seed_mode
mode in the configuration files of both node's. Also in the chain configuration file on both nodes, we report (or add) the following lines, indicating the hash of the newly created event:is_static_genesis_event=true
static_genesis_event=0x77A5058DD364E32CFA674B721B0A419789839275A36B31F5E16CA30C23158BE5
Fire of these events - emissions and the basic transaction - it is possible to implement by completing one command. However, it is more convenient to divide these processes. In the case of creating a network with two or more, this will be the only possible option .
Token emission operations (token_emit command) will be processing automatically only for token owners.
root@node-0:~# cellframe-node-cli wallet info -w my_wallet_0 -net my-testnet
wallet: my_wallet_0
addr: ptV4n68gTebdUTcbnmJeDJxJae7D5prv97CyUJvXyvFweggyd1QK9cgB492Z9GGisLqAJS3JfeYw62nC2Cdr5spWyEJmRR5LPAGBFPDi
network: my-testnet
balance: 0
root@node-0:~# cellframe-node-cli token_emit -net my-testnet -chain_emission zerochain -no_base_tx -token myTKN -certs my-testnet.pvt.0 -emission_value 1000000000000000000 -addr ptV4n68gTebdUTcbnmJeDJxJae7D5prv97CyUJvXyvFweggyd1QK9cgB492Z9GGisLqAJS3JfeYw62nC2Cdr5spWyEJmRR5LPAGBFPDi
Datum 0xC57F02F62C8E717CD93DCD00EC9717D08ADDE586E76A15CEAEEE10AD3C3F1FB9 with 256bit emission is placed in datum pool
root@node-1:~# cellframe-node-cli token_emit sign -emission 0xC57F02F62C8E717CD93DCD00EC9717D08ADDE586E76A15CEAEEE10AD3C3F1FB9 -no_base_tx -certs my-testnet.pvt.1 -net my-testnet
Datum 0xA91159FDFAE5AEF1FD13343B71D42C0238C6188BAADC212A03CC391B6B8744F1 with 256bit emission is placed in datum pool
Mempool_List
command should already see the datum of emissions with two signatures. After that, we will carry out the processing of the membrane on the zero node, indicating the last hesh received.root@node-0:~# cellframe-node-cli mempool_proc -net my-testnet -chain zerochain -datum 0xA91159FDFAE5AEF1FD13343B71D42C0238C6188BAADC212A03CC391B6B8744F1
hash 0xA91159FDFAE5AEF1FD13343B71D42C0238C6188BAADC212A03CC391B6B8744F1: type_id=DATUM_TOKEN_EMISSION ts_create=Thu Oct 6 10:59:55 2022
data_size=6925
Datum processed well. Removed datum from mempool.
[10/06/22-11:07:58] [ * ] [dap_chain_ledger] Added token emission datum to emissions cache: type=AUTH value=1000000000000.0 token=myTKN to_addr=ptV4n68gTebdUTcbnmJeDJxJae7D5prv97CyUJvXyvFweggyd1QK9cgB492Z9GGisLqAJS3JfeYw62nC2Cdr5spWyEJmRR5LPAGBFPDi
[10/06/22-11:08:01] [ * ] [dap_chain_cs_dag_poa] Event 0xBB5F373E1EDBC58A737B74A1DEB98049B661E944F1F05F1E43362D34B43DBCE5 from round 2 added in chain successfully
The basic transaction is a transaction created on the basis of emission.
Transactions (tx_create command) will be automatically processing as usual.
To make a basic transaction, we need to get a hash of emissions.* Important:* It is the Hash emissions, not the hash of the Datum.
root@node-0:~# cellframe-node-cli dag event list -net my-testnet -chain zerochain -from events
0x77A5058DD364E32CFA674B721B0A419789839275A36B31F5E16CA30C23158BE5: ts_create=Thu Oct 6 08:59:23 2022
0xBB5F373E1EDBC58A737B74A1DEB98049B661E944F1F05F1E43362D34B43DBCE5: ts_create=Thu Oct 6 11:06:55 2022
my-testnet.zerochain have total 2 events :
root@node-0:~# cellframe-node-cli dag event dump -from events -net my-testnet -chain zerochain -event 0xBB5F373E1EDBC58A737B74A1DEB98049B661E944F1F05F1E43362D34B43DBCE5
Event 0xBB5F373E1EDBC58A737B74A1DEB98049B661E944F1F05F1E43362D34B43DBCE5:
Header:
version: 0x00
round ID: 2
cell_id: 0x0000000000000000
chain_id: 0x0000000000000000
ts_created: Thu Oct 6 11:06:55 2022
hashes: count: 1
hash: 0x77A5058DD364E32CFA674B721B0A419789839275A36B31F5E16CA30C23158BE5
datum: datum_size: 6940
version:=0x00
type_id:=DATUM_TOKEN_EMISSION
ts_create=Thu Oct 6 10:59:55 2022
data_size=6925
signs: count: 2
type: sig_dil pkey_hash: 0x4822C7090232EC026668B8133BDD33CF02C5AC7E56C7829FCD8A75B0D7CBA29B
type: sig_dil pkey_hash: 0x3C20BC1B92048F0C7C8227546712398EEE0E68B201DD1A9FD52ED3761FBEF1F2
emission: hash 0xD1A33EB63BFDB3BBE87B650F17076BE92908DF227DE1823F7ABDDF29CDB22FDB
1000000000000.0(1000000000000000000000000000000) myTKN, type: AUTH, version: 2
to addr: ptV4n68gTebdUTcbnmJeDJxJae7D5prv97CyUJvXyvFweggyd1QK9cgB492Z9GGisLqAJS3JfeYw62nC2Cdr5spWyEJmRR5LPAGBFPDi
signs_count: 2
tsd_total_size: 0
signatures:
1) 0x4822C7090232EC026668B8133BDD33CF02C5AC7E56C7829FCD8A75B0D7CBA29B, sig_dil, 2096 bytes
2) 0x3C20BC1B92048F0C7C8227546712398EEE0E68B201DD1A9FD52ED3761FBEF1F2, sig_dil, 2096 bytes
In this rather large conclusion, we are interested in the hash of emissions, which is indicated after the key word Emission
. In our case it is 0xD1A33EB63BFDB3BBE87B650F17076BE92908DF227DE1823F7ABDDF29CDB22FDB
.
root@0-node-my-testnet:~# cellframe-node-cli tx_create -net my-testnet -chain zerochain -emission_chain zerochain -from_emission 0xD1A33EB63BFDB3BBE87B650F17076BE92908DF227DE1823F7ABDDF29CDB22FDB -value 1000000000000000000000000000000 -to_addr ptV4n68gTebdUTcbnmJeDJxJae7D5prv97CyUJvXyvFweggyd1QK9cgB492Z9GGisLqAJS3JfeYw62nC2Cdr5spWyEJmRR5LPAGBFPDi -token myTKN -certs my-testnet.pvt.0
transfer=Ok
tx_hash=0x9F78212971BD2316C96ABF4B185A3F866552C40BBF48EF40B7E58C5BDFA8946C
Mempool_List
command should already see the transaction datum. After that, we will process the processing of the membrane on the zero node, indicating the hash of this date.root@0-node-my-testnet:~# cnc mempool_proc -net my-testnet -chain zerochain -datum 0x9F78212971BD2316C96ABF4B185A3F866552C40BBF48EF40B7E58C5BDFA8946C
hash 0x9F78212971BD2316C96ABF4B185A3F866552C40BBF48EF40B7E58C5BDFA8946C: type_id=DATUM_TX ts_create=Fri Oct 7 08:58:41 2022
data_size=3528
Datum processed well. Removed datum from mempool.
root@0-node-my-testnet:~# cellframe-node-cli wallet info -w my_wallet_0 -net my-testnet
wallet: my_wallet_0
addr: ptV4n68gTebdUTcbnmJeDJxJae7D5prv97CyUJvXyvFweggyd1QK9cgB492Z9GGisLqAJS3JfeYw62nC2Cdr5spWyEJmRR5LPAGBFPDi
network: my-testnet
balance:
1000000000000.0 (1000000000000000000000000000000) myTKN