avalanche-rosetta
avalanche-rosetta copied to clipboard
Add P-Chain address derivation support
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.
@StephenButtolph fixed comments and rebase the master.
We are going to merge something in to pchain-support
branch instead of master.