{
  "type": "script",
  "title": "Child Keys Multisign",
  "description": "Derives three stake keys at arbitrary account and address indexes of the current wallet, and requires all three of them as signers of a single transaction. Shows how child keys outside the usual account 0 / address 0 path can co-sign, without setting up a workspace first",
  "exportAs": "MultiSign",
  "require": {
    "not": {
      "walletTypeIn": [
        "extension"
      ]
    }
  },
  "return": {
    "mode": "last"
  },
  "run": {
    "dependencies": {
      "type": "script",
      "run": {
        "keys": {
          "type": "deriveKeys",
          "keys": {
            "A": {
              "name": "A",
              "kind": "stake",
              "accountIndex": 34,
              "addressIndex": 423
            },
            "B": {
              "name": "B",
              "kind": "stake",
              "accountIndex": 632,
              "addressIndex": 7434
            },
            "C": {
              "name": "C",
              "kind": "stake",
              "accountIndex": 26,
              "addressIndex": 754
            }
          }
        }
      }
    },
    "txs": {
      "type": "script",
      "run": {
        "buildMultiSign": {
          "type": "buildTx",
          "title": "Multisign with 3 child stake keys",
          "tx": {
            "requiredSigners": {
              "A": "{get('cache.dependencies.keys.A.pubKeyHashHex')}",
              "B": "{get('cache.dependencies.keys.B.pubKeyHashHex')}",
              "C": "{get('cache.dependencies.keys.C.pubKeyHashHex')}"
            }
          }
        },
        "signMultiSign": {
          "type": "signTxs",
          "detailedPermissions": false,
          "txs": [
            "{get('cache.txs.buildMultiSign.txHex')}"
          ]
        },
        "submitMultiSign": {
          "type": "submitTxs",
          "txs": "{get('cache.txs.signMultiSign')}"
        }
      }
    },
    "finally": {
      "type": "macro",
      "run": {
        "requiredSigners": {
          "A": "{get('cache.dependencies.keys.A.pubKeyHashHex')}",
          "B": "{get('cache.dependencies.keys.B.pubKeyHashHex')}",
          "C": "{get('cache.dependencies.keys.C.pubKeyHashHex')}"
        },
        "txHash": "{get('cache.txs.buildMultiSign.txHash')}"
      }
    }
  }
}