Accounting node change and private key configuration after foking - Second-Earth/setchain GitHub Wiki
Check the block production status through the browser https://scan.setcoin.net, you can restart the node after your own node has just completed the block production, so that the version switch can be completed without losing the block. The restart steps are the same as before: In order to ensure the stability of block production (or the stability of income), the producer node needs to start the main and standby node programs for the same mining account (assuming accout123456), running on different servers. The main node startup process: nohup ./set --genesis=../genesis.json --p2p_id=1 --miner_start & // Start the node, the data is saved in /root/.set_ledger by default ./set miner setcoinbase "accout123456" priKey.txt // Set coinbase, priKey.txt can be deleted after setting
Backup node startup process: nohup ./set --genesis=../genesis.json --p2p_id=1 --miner_start & // Start the node, the data is saved in /root/.set_ledger by default ./set miner setcoinbase "accout123456" priKey.txt // Set coinbase, priKey.txt can be deleted after setting ./set miner setdelay 200 //delay 200ms // set mining delay 200ms
Note: (1) Before the start of a cycle, the block must be synchronized to the latest, after which the node can produce the block (2) If it is a rented Alibaba Cloud or AWS server, remember to open the inbound port in the security group (the default P2P port is 2018), otherwise other nodes will not be able to connect to your node, which will affect the establishment of the P2P network
Check the block production status through the browser https://scan.setcoin.net, and just after the block is produced, the node sends the set-up private mining public key and configures the private key.
(1). No need to restart the node, set the coinbase:
./set miner setcoinbase "accout123456" priKey.txt
(2). Send the configuration dedicated mining public key after the fork. This public key is the public key corresponding to the private key configured in step (1).
func UpdateCandidatePubKey(pubKey common.PubKey, from, to common.Name, nonce uint64, prikey *ecdsa.PrivateKey) {
arg := &args.UpdateCandidatePubKey{ PubKey: pubKey, } payload, err := rlp.EncodeToBytes(arg) if err != nil { panic(err) } key := types.MakeKeyPair(prikey, []uint64{0}) sendTransferTx(types.UpdateCandidatePubKey, from, to, nonce, 0, big.NewInt(0), payload, []*types.KeyPair{key}) } func sendTransferTx(txType types.ActionType, from, to common.Name, nonce, assetID uint64, value *big.Int, input []byte, keys []*types.KeyPair) { action := types.NewAction(txType, from, to, nonce, assetID, gasLimit, value, input, nil) gasprice, _ := testcommon.GasPrice() tx := types.NewTransaction(0, gasprice, action) signer := types.MakeSigner(big.NewInt(1)) err := types.SignActionWithMultiKey(action, tx, signer, 0, keys) if err != nil { jww.ERROR.Fatalln(err) } rawtx, err := rlp.EncodeToBytes(tx) if err != nil { jww.ERROR.Fatalln(err) } hash, err := testcommon.SendRawTx(rawtx) if err != nil { jww.INFO.Println("result err: ", err) } fmt.Println("result hash: ", hash.Hex()) jww.INFO.Println("result hash: ", hash.Hex()) }