Miner API

API reference for miner nodes

APIs for Edge Nodes

Upload a trained local model to miner

POST http://miner_addr:port/new_transaction

Not only model with weight and bias, but also some other info are upload together. We call them as a transaction, which is a concept borrow from blockchain.

Request Body

Name
Type
Description

"author"*

String

unique id of the uploader

"content"*

json

json of model information, check source code for reference.

"type"*

String

fixed as: "localModelWeight"

"timestamp"*

long

timestamp

"plz_spread"

int

whether want the miner to share this local model with other miners, having this field means true.

"seed_name"*

String

seed name of this model

{
    // Response
}

Get the latest global model from the miner

GET http://miner_addr:port/global_model

APIs for Blockchain

Get the full chain from a miner

GET http://miner_addr:port/chain

Get the length of current chain together with the latest block

GET http://miner_addr:port/chain_simple

Mainly used for faster consensus.

One miner shares his newly mined block with another miner

POST http://miner_addr:port/add_block

Request Body

Name
Type
Description

"local_list"*

json

list of local models, might be empty

"prev_hash"*

String

previous block hash

"time_stamp"*

long

timestamp

"index"*

int

index of this block

"miner"*

String

unique id of the miner of this block

"base_global"*

json

base global model of this block

"hash"*

String

this block's hash

"nonce"*

long

nonce of this block

"difficulty"*

int

difficulty of this blockchain

"seed_name"*

String

seed name of the model

"local_hash"*

String

hash of the local list (to reduce the size)

"new_global"*

json

new global model of this block

return the list of those local transactions who haven't be included into the block

GET http://miner_addr:port/pending_tx

Seed node inject a new seed into miner network through this api

POST http://miner_addr:port/seed_update

Request Body

Name
Type
Description

"name"*

String

name of the new seed

"from"*

String

name of the seed node

"seedWeight"*

json

new global modal of this new seed

"para"*

json

all kinds of para

"peers"*

json

list of peer miners

Last updated