Skip to content

RPC method "getMiningObject"

Paul edited this page Jun 26, 2022 · 6 revisions

This method allows to get 3D object, inherent to a certain block, out of the blockchain. The method is applicable only to the objects mined and being a part of the block header. It might be

curl -H "Content-Type: application/json" -d 
'{"id":1, 
  "jsonrpc":"2.0", 
  "method": "poscan_getMiningObject", 
  "params": ["0x1e76d5f98d8a6047e6a2a7c999dd362cc62b3413b602c857917f3913e69b7c7e"]
 }' http://localhost:9933/

Where 0x1e76d5f98d8a6047e6a2a7c999dd362cc62b3413b602c857917f3913e69b7c7e is the block hash

The output contains parameter "result", which is a 3D model in obj format with \n added at the tail of each line.

{"jsonrpc":"2.0","result":"o \nv 0.09 0.83 0.04\nv 0.08 0.83 0.09\nv 0.06 0.83 0.13\nv 0.04 0.83 0.17\nv 0.01 0.83 0.2\nv -0.02 0.83 0.22\nv -0.05 0.84 0.22\nv -0.08 0.85 0.23\nv -0.09 0.86 0.22\n...","id":1}

In order to format it into regular obj all you need to do is to cut off all \n.

o 
v 0.09 0.83 0.04
v 0.08 0.83 0.09
v 0.06 0.83 0.13
v 0.04 0.83 0.17
v 0.01 0.83 0.2
v -0.02 0.83 0.22
v -0.05 0.84 0.22
v -0.08 0.85 0.23
v -0.09 0.86 0.22
...

You can save it as object.obj file to preview on web pages and viewer apps.

Clone this wiki locally