서비스를 개발에 필요한 공통 기능(코인정보, 소유자 Nonce발행, 통신 Interface기능 등)을 제공합니다.
/svm/common/querySendPacket
Terminal - API for BN communication
API for communication from terminal
to blockchain
Example
NhApp - Mobile sample
String query = “{\n“ + “ \”query_type\”: \”query\”,\n“ + “ \”func_name\”: \”infoTrans\”,\n“ + “ \”func_args\”: [\n“ + “ \”PID\”,\n“ + “ \”10000\”,\n“ + “ \”cMggcCKygby5GP2uCfKP7wnqgZxnnpqZKVzrF6btVyY2M1e1LtkE\”,\n“ + “ \”cMfm2P4eczdqTeKhXg5cgG6k1DaBxGM6CCayfWqUCQ9phXNxJL1u\”\,\n“ + “ \”R\”,\n“ + “ \”1234\”,\n“ + “ \”AePJWWvDxd\”,\n“ + “ \”381yXZTiA4yeduQdhA5XvrRye62b9GDS2W2A4cxp9sUzbi4ts4jypWbAw9KdJYUFqHzhxDZU1kh.......\”,\n“ + “ \”cMggcCKygby5GP2uCfKP7wnqgZxnnpqZKVzrF6btVyY2M1e1LtkE\”\n“ + “ ]\n“ + “}“ String host = "127.0.0.1:8080" String path = "/svm/common/querySendPacket" String response = HTTP_POST(host + path, query);
/svm/common/getNonce
Nonce value extraction API for signature
Generate and obtain the nonce information necessary for generating the private signature.
Example
SApp - Javascript sample
var psQuery = {"pid":"PID", "ver":"10000", "nType":"query", "chainID":"chainID"}; $.ajax({ url: "/svm/common/getNonce", type: 'POST', data: JSON.stringify(psQuery), dataType: 'json', contentType:"application/json;charset=UTF-8", success: function(data) { retData = data; }, error:function(data,status,er) { alert("error: "+data.responseText+" status: "+status+" er:"+er); } });
Request parameters
Result
Result parameters
parameter name | Description | |
---|---|---|
ecstring |
Error code If it is processed normally, it returns '0'. |
|
noncestring |
nonce value | |
refstring |
Result message | |
npidstring |
Node agent peer id | |
Response sampleJSON Object |
{ "result": "OK", "nonce": "kdjfucx0j2hjsaggh", "npid":"00" } |
/svm/common/getCoinInfo
API for Obtaining Block Chain Coin Information
Read the coin information set in the block chain.
Example
SApp - Javascript sample
$.ajax({ url: "/svm/common/getCoinInfo", type: 'POST', dataType: 'json', contentType:"application/json;charset=UTF-8", success: function(data) { retData = data; }, error:function(data,status,er) { alert("error: "+data.responseText+" status: "+status+" er:"+er); } });
Request parameters
Result
Result parameters
parameter name | Description | |
---|---|---|
nmstring |
Coin name | |
coustring |
Coin trading unit | |
Response sampleJSON Object |
{"nm":"coin name","cou":"WON"} |
/svm/common/callCorsUrl
TerminalNode calls this function to select a service for the first time.
The Nodehome Platform is developed to support Cross-Origin Resource Sharing(CORS) between SVMs.
Example
SApp - Javascript sample
var sQuery = {"requestUrl" : "requestUrl", "serviceID" : "serviceID"}; $.ajax({ url: "/svm/common/callCorsUrl", type: 'POST', data: JSON.stringify(sQuery), dataType: 'json', contentType:"application/json;charset=UTF-8", success: function(data) { alert(JSON.stringify(data)); }, error:function(data,status,er) { alert("error: "+data.responseText+" status: "+status+" er:"+er); } });
Request parameters
Result
Result parameters
parameter name | Description | |
---|---|---|
JSON Object |
Receives the result of the requested SVM Api. | |
Response sampleJSON Object |
{ "Key": "Value", "Key": "Value", "Key": "Value" } |