Skip to main content

Cardano Example Dapp

Key derivation formats​

Explore the different ways to derive/obtain keys and obtain all results under the same format

Try it online:​

Source code:​

Dapp code was autogenerated by Playground IDE in GameChanger Wallet

GCScript code (dapp connection):​

{
"type": "script",
"title": "Key derivation formats",
"description": "Explore the different ways to derive/obtain keys and obtain all results under the same format",
"exportAs": "data",
"run": {
"mainSpend": {
"type": "getSpendingPublicKey"
},
"mainStake": {
"type": "getStakingPublicKey"
},
"derivePublicKeys": {
"type": "deriveKeys",
"keys": {
"_spend10": {
"name": "spend10",
"kind": "spend",
"accountIndex": 5,
"addressIndex": 10
},
"_stake10": {
"name": "stake10",
"kind": "stake",
"accountIndex": 5,
"addressIndex": 10
},
"_spend10Copy": {
"name": "spend10Copy",
"path": "m/1852h/1815h/5h/0/10"
},
"_stake10Copy": {
"name": "stake10Copy",
"path": "m/1852h/1815h/5h/2/10"
}
}
},
"usingWorkspaces": {
"type": "loadConfig",
"updateId": "demo",
"layers": [
{
"type": "Workspace",
"items": [
{
"namePattern": "derivations",
"titlePattern": "Derivations",
"descriptionPattern": "Wallet settings generated by a demo script to test key derivations"
}
]
},
{
"type": "Key",
"workspaceIds": [
"derivations"
],
"namePattern": "{index}_{key}_{kind}_{accountIndex}_{addressIndex}",
"items": [
{
"namePattern": "{kind}{addressIndex}",
"kind": "spend",
"accountIndex": 5,
"addressIndex": 10
},
{
"namePattern": "{kind}{addressIndex}",
"kind": "stake",
"accountIndex": 5,
"addressIndex": 10
},
{
"namePattern": "{kind}{addressIndex}Copy",
"pathPattern": "m/1852h/1815h/5h/0/10"
},
{
"namePattern": "{kind}{addressIndex}Copy",
"pathPattern": "m/1852h/1815h/5h/2/10"
},
{
"pathPattern": "m/1852h/1815h/5h/1/0"
},
{
"pathPattern": "m/1852h/1815h/0h/0/{index}"
},
{
"pathPattern": "m/1852h/1815h/1h/0/{index}"
},
{
"pathPattern": "m/1852h/1815h/2h/0/{index}"
},
{
"pathPattern": "m/1852h/1815h/3h/0/{index}"
},
{
"pathPattern": "m/1852h/1815h/4h/0/{index}"
}
]
}
]
},
"setWorkspace": {
"type": "setCurrentWorkspace",
"workspaceId": "derivations"
},
"keysInWorkspace": {
"type": "script",
"run": {
"allKeys": {
"type": "getPublicKeys"
},
"accountOnly": {
"type": "getPublicKeys",
"keyPattern": "{path}",
"filter": {
"isAccount": true
}
},
"onlyAccountIndex1": {
"type": "getPublicKeys",
"keyPattern": "{artifactName}",
"filter": {
"accountIndex": 1
}
},
"onlyAccountIndex5": {
"type": "getPublicKeys",
"keyPattern": "{artifactName}",
"filter": {
"pathPrefix": "m/1852h/1815h/5h/"
}
}
}
}
}
}

Run standalone QR dapp connection:​

You can use Playground IDE in GameChanger Wallet in QR URL Transport mode to capture results

This GCScript/URL is too large! make it shorter uploading parts to GCFS. Unable to generate QR code

Resources​

License​

MIT