Skip to main content

Create a Bitcoin Master Key

This tutorial shows how to create a Master Key for a Bitcoin Wallet directly inside a Primus HSM. This Master Key is protected with an authorization policy using Smart Key Attributes.

tip

Instead of creating a new Master Key, you can also import a key from a seed.

Request

POST /v1/key

The rule for using the key will be defined as 1 of 2 Finance Officers AND 1 of 2 Risk Officers

{
"label": "TSB_TUTORIAL_3-BITCOIN",
"algorithm": "EC",
"curveOid": "1.3.132.0.10",
"addressFormat": {
"format": "BTC"
},
"attributes": {
"decrypt": false,
"sign": true,
"unwrap": false,
"destroyable": true,
"modifiable": true,
"derive": true,
"bip32": true
},
"policy": {
"ruleUse": {
"tokens": [
{
"name": "Token1",
"timelock": 0,
"timeout": 3600,
"groups": [
{
"name": "FinanceOfficers",
"quorum": 2,
"approvals": [
{
"type": "public_key",
"name": "FinanceOfficer1",
"value": "MFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAEvYPsJeuck/SOotORgxN6Kih9EbfZGTrFht8gv0ASBRjoD3Jlh5w4+QQAZMeBLIy23rCxwYYouN6x5xiOZCH2/g=="
},
{
"type": "public_key",
"name": "FinanceOfficer2",
"value": "MFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAEJsYPk79qiD2mc6obIhvVj76LU14z022M4aogxxUdrQSSNJrSsJqpiT+tnVF66q5h4B3NHaLc3nOm8yBY0jJZew=="
},
{
"type": "public_key",
"name": "FinanceOfficer3",
"value": "MFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAEpoiulRerdrbKqmRMmR/udw9FqsrlsBVz4dptoESQdwvy+Xi0jOaoikRd7weYeRtZoRw9xAqiOME+P7XWnuh1Pg=="
},
{
"type": "public_key",
"name": "FinanceOfficer4",
"value": "MFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAEpeeOY7L02jwxJi+z40BMKjD2xf7md8wRQSna3JvfYYPUejRtxDX0tRQWmg9r0PEj6h4aenNAoo+2pXiKRdsInA=="
},
{
"type": "public_key",
"name": "FinanceOfficer5",
"value": "MFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAEBIV/KkJzFD0zJuPEl1UkEO/qh7fQ+MsXm1jvuOaXyg3LlZSQC1l1OQJM804x1At8oXZnr/0U2SHiOtyfpBD1xQ=="
}
]
}
]
}
]
},
"keyStatus": {
"blocked": false
}
}
}
info

You must set "derive": true and "bip32": true if you want to be able to derive Child Keys from the Master Key.

Response

{
"label": "TSB_TUTORIAL_3-BITCOIN",
"algorithm": "EC",
"curveOid": "1.3.132.0.10",
"addressFormat": {
"format": "BTC"
}
}

Deriving Child Keys

Now that you have a Master Key, you can derive child keys such as m/44'/0'/0'/0/0 from it to build your hierarchical deterministic wallets (HD wallets).

For details about child key derivation with the REST API, see this tutorial.

Get started withCloudHSM for free.
Other questions?Ask Sales.
Feedback
Need help?