avalanche-rosetta icon indicating copy to clipboard operation
avalanche-rosetta copied to clipboard

Add P-Chain address derivation support

Open xiaoxiaff opened this issue 2 years ago • 2 comments

This PR adds support for P-Chain address derivation.

The P chain network identifier will be:

&types.NetworkIdentifier{
		Blockchain: service.BlockchainName,
		Network:    cfg.NetworkName,
		SubNetworkIdentifier: &types.SubNetworkIdentifier{
			Network: "P",
		},
	}

Test:

curl --data '{"network_identifier"
:{"blockchain":"Avalanche","network":"Fuji", "sub_network_identifier":
{"network":"P"}},"public_key":{"hex_bytes":"02d95fcfa4321a1291bd8b3876
35fe0c3b9fa6d243153387fbe298a467b0c2ab32","curve_type":"secp256r1"}}' --header "Content-Type: application/json" --request POST 0.0.0.0:8080/construction/derive | jq .

{
  "address": "P-fuji1s8rrueqvga8597f0nks60m9urtxutw98rx9rdu",
  "account_identifier": {
    "address": "P-fuji1s8rrueqvga8597f0nks60m9urtxutw98rx9rdu"
  }
}

This change is backward compatible since it only derive P-chain address for P-chain request.

Will update test cases once core functionality and structure has been reviewed.

xiaoxiaff avatar May 26 '22 15:05 xiaoxiaff

@StephenButtolph fixed comments and rebase the master.

xiaoxiaff avatar Jun 10 '22 18:06 xiaoxiaff

We are going to merge something in to pchain-support branch instead of master.

patrick-ogrady avatar Jun 30 '22 19:06 patrick-ogrady