MCPcopy Create free account
hub / github.com/DNAProject/DNA / StartRPCServer

Function StartRPCServer

http/jsonrpc/rpc_server.go:35–70  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

33)
34
35func StartRPCServer() error {
36 log.Debug()
37 http.HandleFunc("/", rpc.Handle)
38
39 rpc.HandleFunc("getbestblockhash", rpc.GetBestBlockHash)
40 rpc.HandleFunc("getblock", rpc.GetBlock)
41 rpc.HandleFunc("getblockcount", rpc.GetBlockCount)
42 rpc.HandleFunc("getblockhash", rpc.GetBlockHash)
43 rpc.HandleFunc("getconnectioncount", rpc.GetConnectionCount)
44 rpc.HandleFunc("getsyncstatus", rpc.GetSyncStatus)
45 //HandleFunc("getrawmempool", GetRawMemPool)
46
47 rpc.HandleFunc("getrawtransaction", rpc.GetRawTransaction)
48 rpc.HandleFunc("sendrawtransaction", rpc.SendRawTransaction)
49 rpc.HandleFunc("getstorage", rpc.GetStorage)
50 rpc.HandleFunc("getversion", rpc.GetNodeVersion)
51 rpc.HandleFunc("getnetworkid", rpc.GetNetworkId)
52
53 rpc.HandleFunc("getcontractstate", rpc.GetContractState)
54 rpc.HandleFunc("getmempooltxcount", rpc.GetMemPoolTxCount)
55 rpc.HandleFunc("getmempooltxstate", rpc.GetMemPoolTxState)
56 rpc.HandleFunc("getsmartcodeevent", rpc.GetSmartCodeEvent)
57 rpc.HandleFunc("getblockheightbytxhash", rpc.GetBlockHeightByTxHash)
58
59 rpc.HandleFunc("getbalance", rpc.GetBalance)
60 rpc.HandleFunc("getallowance", rpc.GetAllowance)
61 rpc.HandleFunc("getmerkleproof", rpc.GetMerkleProof)
62 rpc.HandleFunc("getblocktxsbyheight", rpc.GetBlockTxsByHeight)
63 rpc.HandleFunc("getgasprice", rpc.GetGasPrice)
64
65 err := http.ListenAndServe(":"+strconv.Itoa(int(cfg.DefConfig.Rpc.HttpJsonPort)), nil)
66 if err != nil {
67 return fmt.Errorf("ListenAndServe error:%s", err)
68 }
69 return nil
70}

Callers 1

initRpcFunction · 0.92

Calls 3

DebugFunction · 0.92
HandleFuncFunction · 0.92
ErrorfMethod · 0.80

Tested by

no test coverage detected