BeamMW / beam

Beam: Scalable Confidential Cryptocurrency. Leading the way to Confidential DeFi
https://beam.mw
Apache License 2.0
700 stars 205 forks source link

How to run a local testnet (for testing the hardfork) #785

Closed guybrush closed 5 years ago

guybrush commented 5 years ago

I tried to follow the guide on the wiki: https://github.com/BeamMW/beam/wiki/Testing-Beam-Hard-Fork-on-Local-Testnet.

It links to http://documentation.beam.mw/en/latest/rtd_pages/dev_local_setup.html which is not up to date I think (e.g. ./beam-node --mining_threads=1 --treasury_path=treasury.bin --owner_key=<owner key> --miner_key=<miner key> --pass=<wallet password> will not work since --treasury_path and --mining_threads seem to be obsolete now?).

I tried to start a node with this command:

./beam-node-testnet \
    --miner_key="<key>" \
    --owner_key="<key>" \
    --pass="<pass>" \
    --Fork1=10 \
    --Fork2=20 \
    --stratum_port=3333

This is the output of the node:

I 2019-07-24.14:24:14.595 Beam Node 3.0.5674 (testnet)
I 2019-07-24.14:24:14.595 Rules signature: 0-cfa9cf691cfe775a, 10-0a5a94e2d29868bf, 20-cfef7b1c4d72d841
I 2019-07-24.14:24:14.805 starting a node on 10000 port...
I 2019-07-24.14:24:14.820 Settings configuration
I 2019-07-24.14:24:14.820 Loading UTXOs...
I 2019-07-24.14:24:14.820 Node ID=c7343f134cc1ca51
I 2019-07-24.14:24:14.820 Initial Tip: 0-0000000000000000
I 2019-07-24.14:24:14.820 Tx replication is OFF
I 2019-07-24.14:24:14.820 Rescanning owned Txos...
I 2019-07-24.14:24:14.820 Recovered 0/0 unspent/total Txos
I 2019-07-24.14:24:14.820 Requesting block 0-0000000000000000
I 2019-07-24.14:24:14.821 stratum server listens to 0.0.0.0:3333
D 2019-07-24.14:24:42.149 stratum server +peer 127.0.0.1:35658
D 2019-07-24.14:24:42.149  size=191
D 2019-07-24.14:24:42.150 send_pending_data this=0x7f001804de38 bytes=978
D 2019-07-24.14:24:42.151  size=318
D 2019-07-24.14:24:42.169 send_pending_data this=0x7f001804de38 bytes=51
D 2019-07-24.14:24:42.200  size=101
Fork Height: 10
D 2019-07-24.14:24:42.200 send_pending_data this=0x7f001804de38 bytes=127

This is all I get via stratum:

I: {"method":"login", "api_key":"aaaa1234", "id":"login","jsonrpc":"2.0"} 
O: {"code":0,"description":"Success","forkheight":10,"id":"login","jsonrpc":"2.0","method":"result"}

I also tried to run 2 nodes and connect each other, with no result.

Am I missing something?

sinaizd commented 5 years ago

Hello. You need to download treasury.bin .Place this file in the folder where the node is located. In "beam-node-testnet" CFG file and specify the path to this file for example:treasury_path=C:\Users\Administrator\Documents\beam-node-testnet\treasury.bin

guybrush commented 5 years ago

Thanks that works!

Note: the --treasury_path-flag and config-key is not documented.

./beam-node-testnet -h
Allowed options:

General options:
  -h [ --help ]                         list of all options
  --log_level arg                       log level [info|debug|verbose]
  --file_log_level arg                  file log level [info|debug|verbose]
  --log_cleanup_days arg (=5)           old logfiles cleanup period(days)
  -v [ --version ]                      return project version
  --git_commit_hash                     return commit hash

Node options:
  -p [ --port ] arg (=10000)            port to start the server on
  --storage arg (=node.db)              node storage path
  --verification_threads arg (=-1)      number of threads for cryptographic 
                                        verifications (0 = single thread, -1 = 
                                        auto)
  --nonceprefix_digits arg (=0)         number of hex digits for nonce prefix 
                                        for stratum client (0..6)
  --peer arg                            nodes to connect to
  --stratum_port arg (=0)               port to start stratum server on
  --stratum_secrets_path arg (=.)       path to stratum server api keys file, 
                                        and tls certificate and private key
  --stratum_use_tls arg (=1)            enable TLS on startum server
  --resync arg (=0)                     Enforce re-synchronization (soft reset)
  --reset_id arg (=0)                   Reset self ID (used for network 
                                        authentication). Must do if the node is
                                        cloned
  --erase_id arg (=0)                   Reset self ID (used for network 
                                        authentication) and stop before 
                                        re-creating the new one.
  --check_db arg (=0)                   DB integrity check and compact (vacuum)
  --bbs_enable arg (=1)                 Enable SBBS messaging
  --crash arg (=0)                      Induce crash (test proper handling)
  --owner_key arg                       Owner viewer key
  --key_owner arg                       Owner viewer key (deprecated)
  --miner_key arg                       Standalone miner key
  --key_mine arg                        Standalone miner key (deprecated)
  --pass arg                            password for keys
  --log_utxos arg (=0)                  Log recovered UTXOs (make sure the log 
                                        file is not exposed)
  --horizon_hi arg (=18446744073709551615)
                                        spent TXO Hi-Horizon
  --horizon_lo arg (=18446744073709551615)
                                        spent TXO Lo-Horizon
  --generate_recovery arg               Recovery file to generate immediately 
                                        after start
  --recovery_auto_path arg              path and file prefix for recovery 
                                        auto-generation
  --recovery_auto_period arg (=30)      period (in blocks) for recovery 
                                        auto-generation

Rules configuration:
  --Emission.Value0 arg (=8000000000)   initial coinbase emission in a single 
                                        block
  --Emission.Drop0 arg (=525600)        height of the last block that still has
                                        the initial emission, the drop is 
                                        starting from the next block
  --Emission.Drop1 arg (=2102400)       Each such a cycle there's a new drop
  --Maturity.Coinbase arg (=240)        num of blocks before coinbase UTXO can 
                                        be spent
  --Maturity.Std arg (=0)               num of blocks before non-coinbase UTXO 
                                        can be spent
  --MaxBodySize arg (=1048576)          Max block body size [bytes]
  --DA.Target_s arg (=60)               Desired rate of generated blocks 
                                        [seconds]
  --DA.MaxAhead_s arg (=900)            Block timestamp tolerance [seconds]
  --DA.WindowWork arg (=120)            num of blocks in the window for the 
                                        mining difficulty adjustment
  --DA.WindowMedian0 arg (=25)          How many blocks are considered in 
                                        calculating the timestamp median
  --DA.WindowMedian1 arg (=7)           Num of blocks taken at both endings of 
                                        WindowWork, to pick medians
  --DA.Difficulty0 arg (=134217728)     Initial difficulty
  --Fork1 arg (=270910)                 Height of the 1st fork
  --Fork2 arg (=18446744073709551615)   Height of the 2nd fork
  --AllowPublicUtxos arg (=0)           set to allow regular (non-coinbase) 
                                        UTXO to have non-confidential signature
  --FakePoW arg (=0)                    Don't verify PoW. Mining is simulated 
                                        by the timer. For tests only
sinaizd commented 5 years ago

We can add this flag to the CFG file. https://github.com/BeamMW/beam/issues/786