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

{
    // Response
}

Get the latest global model from the miner

GET http://miner_addr:port/global_model

GET_resp = {
    "weight": state_dict_of_global_weight,
    "preprocPara": {
	"avg": list_of_avg_double,
	"std": list_of_std_double
	},
    "trainPara": {
        "batch": local_training_batch_size,
	"lr": learning_rate,
	"opt": optimization_algorithm,
	"epoch": local_training_epoch_num,
	"loss": local_training_loss_func,
	},
    "samplePara": {
	"center_freq": center_frequency_int,
	"bandwidth": bandwidth_int,
	},
    "layerStructure": a_list_describe_layer_structure,
    "seed_name": seed_name,
    "generation": generation_number_of_the_seed,
}

APIs for Blockchain

Get the full chain from a miner

GET http://miner_addr:port/chain

{
    "length" : length_of_chain_int,
    "chain" : detailed_list_of_blocks
}

Get the length of current chain together with the latest block

GET http://miner_addr:port/chain_simple

Mainly used for faster consensus.

{
    "length" : length_of_chain_int,
    "latest_block" : details_of_the_last_block
}

One miner shares his newly mined block with another miner

POST http://miner_addr:port/add_block

Request Body

{
    // Response
}

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

GET http://miner_addr:port/pending_tx

{
    // Response
}

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

POST http://miner_addr:port/seed_update

Request Body

{
    // Response
}

Last updated