使用 Azure 托管 CCF(托管 CCF),在引入新功能或 bug 修复可用时,可以简单且快速地更新应用程序。 本教程基于快速入门中创建的托管 CCF 资源:使用 Azure 门户教程创建 Azure 托管 CCF 资源 。
先决条件
- Python 3+。
 - CCF Python 包的最新版本。
 
下载服务标识
Azure 托管 CCF 资源具有一个名为服务标识的唯一标识,由证书表示,并在资源创建期间创建。 属于 Azure 托管 CCF 资源的每个单独节点都有其自签名证书,由服务标识认可,该证书可对其建立信任。
建议客户下载服务标识证书,并在与服务交互时使用它建立 TLS 连接。 以下命令下载证书并将其保存到 service_cert.pem 中。
curl https://identity.confidential-ledger.core.azure.com/ledgerIdentity/confidentialbillingapp --silent | jq ' .ledgerTlsCertificate' | xargs echo -e > service_cert.pem
更新应用程序
注释
在 Mac 上执行命令时,请替换为 date -Isdate +%FT%T%z。
- 通过创建建议提交 set_js_app.json 中存在的应用程序捆绑包。
 
$ proposalid=$( (ccf_cose_sign1 --content set_js_app.json --signing-cert member0_cert.pem --signing-key member0_privk.pem --ccf-gov-msg-type proposal --ccf-gov-msg-created_at `date -Is` | curl https://confidentialbillingapp.confidential-ledger.azure.com/gov/proposals -H 'Content-Type: application/cose' --data-binary @- --cacert service_cert.pem | jq -r '.proposal_id') )
- 下一步是通过提交投票来接受该提案。
 
cat vote_accept.json
{
  "ballot": "export function vote (rawProposal, proposerId)\n
  {\n
    // Accepts any proposal\n
    return true;\n
  }"
}
ccf_cose_sign1 --content vote_accept.json --signing-cert member0_cert.pem --signing-key member0_privk.pem --ccf-gov-msg-type ballot --ccf-gov-msg-created_at `date -Is` --ccf-gov-msg-proposal_id $proposalid | curl https://confidentialbillingapp.confidential-ledger.azure.com/gov/proposals/$proposalid/ballots -H 'Content-Type: application/cose' --data-binary @- --cacert service_cert.pem
- 对托管 CCF 资源中的每个成员重复上述步骤。
 
命令完成后,应用程序将更新并准备好接受用户事务。