目录
当前位置: 首页 > 文档资料 > MOAC 中文 WIKI >

MicroChainSCSMonitor

优质
小牛编辑
130浏览
2023-12-01

SCS Monitor

SCS Monitor is a SCS node monitoring MicroChain status. MicroChain users can use this SCS node to monitor MicroChain status and get data from MicroChain.

Users can use RPC settings to get information fron SCS monitor.

SCS monitor can only read data from MicroChain, not submitting any data. It does not join the consensus and cannot get rewards from MicroChain.

SCS monitor can monitor MicroChain after it starts. The MicroChain user need to call the "registerAsMonitor" method in MicroChain contract to register it.

Example 1:

The registerAsMonitor call method to connect SCS monitor with MicroChain:

function subchainRegisterAsMonitor (dappAddr,dappPasswd,microchainAddr,scsAddr)
{
    chain3.personal.unlockAccount(dappAddr, dappPasswd,0);
    sendtx(dappAddr, microchainAddr, '0', '0x4e592e2f000000000000000000000000' + scsAddr );
}

Parameters:

  • dappAddr、dappPasswd:Dapp user account and password to unlock the account;
  • microchainAddr:MicroChain contract address;
  • scsAddr:scsid of SCS monitor, should be in the directory:“…/scsserver/scskeystore”;
  • string: ‘0x4e592e2f’ is a constant to access the subchainbase method ‘registerAsMonitor(address monitor), do not change it.

Example 2:

Calling example

subchainRegisterAsMonitor ('0x1b9ce7e4f156c1......913a56cd986786',
‘123’,
'0x09f0dfc09bee......b85e5189a7493671',
'f687272ae00f8cea01b8cedf37dd9be30329d8cf')//No prefix '0x' for the scsId

There are two kind of rpc ports provided by SCS node. One is RPC with JSON format commands: The other one is rpcdebug, used with more advanced commands:

  • func (scs ScsRPCMethod) GetAllAccountsBalance(args GetAllAccountsBalanceReq, reply *GetAllAccountsBalanceRsp)
  • func (scs ScsRPCMethod) GetTransactionRecords(args Args, reply *RecordRsp)
  • func (scs ScsRPCMethod) GetWaitingData(args GetSubChainReq, reply *WaitingDataRsp)
  • func (scs ScsRPCMethod) GetScsId(args Args, reply *common.Address)
  • func (scs ScsRPCMethod) GetDappState(args GetSubChainReq, reply *uint64)
  • func (scs ScsRPCMethod) GetDappAddrList(args GetSubChainReq, reply *[]common.Address)
  • func (scs ScsRPCMethod) GetNonce(args Args, reply *uint64)
  • func (scs ScsRPCMethod) GetTxpool(args GetTxpoolReq, reply *GetTxpoolRsp)
  • func (scs ScsRPCMethod) GetBalance(args Args, reply *string)
  • func (scs ScsRPCMethod) GetBlockNumber(args GetSubChainReq, reply *big.Int)
  • func (scs ScsRPCMethod) GetBlock(args GetBlockReq, reply *RpcBlock)
  • func (scs ScsRPCMethod) GetBlocks(args GetBlocksReq, reply *[]RpcBlock)
  • func (scs ScsRPCMethod) GetTxRlt(args GetTxReq, reply *string)
  • func (scs ScsRPCMethod) GetTransactionByNonce(args GetTxReq, reply *RPCTransaction)
  • func (scs ScsRPCMethod) GetTransactionByHash(args GetTransactionByHashReq, reply *RPCTransaction)
  • func (scs ScsRPCMethod) GetReceipt(args GetTxReq, reply *scstypes.Receipt)
  • func (scs ScsRPCMethod) GetData(argsData ArgsData, reply *[]byte)
  • func (scs ScsRPCMethod) GetSubChainInfo(args GetSubChainReq, reply *RpcSubChainInfo)
  • func (scs ScsRPCMethod) GetStorageAt(args GetStorageAtReq, contractInfo types.ContractInfo)
  • func (scs ScsRPCMethod) GetContractInfo(args libtypes.GetContractInfoReq, contractInfo *types.ContractInfo)
  • func (scs ScsRPCMethod) PublicCall(args PublicCallReq, reply *string)
  • func (scs ScsRPCMethod) SetDappAbi(args PublicCallReq, reply *string)
  • func (scs ScsRPCMethod) AnyCall(args GetAnyCallReq, reply *string)
  • func (scs ScsRPCMethod) GetExchangeInfo(args GetExchangeReq, reply *GetExchangeRsp)
  • func (scs ScsRPCMethod) GetExchangeByAddress(args GetExchangeByAddressReq, reply *GetExchangeByAddressRsp)