HiBON Remote Procedure Call (HiRPC)

HiRPC is a RPC which can including digital signatures and it is base on HiBON data format.

Structure of HiRPC

{
    $@ : 'HiPRC',
    $sign : <bin>, // Optional
    $pkey  : <bin>, // Optional
    $msg : {
        id : <uint>,
        method : <string>, // Name of the method
        params : <Document>, // Optional
    }
}

The member sign is the $sign hirpc object and $pkey is the public-key which also include a $sign schema code in the genetic package.

The method may include a ‘.’
Only the last string behind the dot is interpreted as the function name. The string preceeding is an optional entity name.
Eg. tagion full nodes accept dartRead commands with no entity prefix to read from main dart. And the trt.dartRead to read from the trt(transaction reverse table) dart. See the tagion hirpcmethods for more examples.

Success full result

{
    $@ : 'HiRPC',
    $sign : <bin>, // Optional
    $pkey : <bin>, // Optional
    $msg : {
        id : <uint>,
        result : <Document>
    }
}

Failure result

{
    $@ : 'HiRPC',
    $sign : <bin>, // Optional
    $pkey : <bin>, // Optional
    $msg : { // This part is signed
        id : <uint>,
        code : <uint>, // Optional
        message : <string> // Optional
	    data : <DOCUMENT> // Optional
    }
}