LoginSignup
6
1

More than 5 years have passed since last update.

Azure Blockchain Workbench の Hello World

Posted at

こちらの記事は、Qiita に掲載した Microsoft Azure Tech Advent Calendar 2018 の企画に基づき、執筆した 内容となります。(3 日目)

Azure に Blockchain プロジェクトを簡単に構築できる Azure Blockchain Workbench がプレビューで公開されてます。簡単に Hello World 的な最初のステップを試してみます。

1 プロジェクトの作成

Azure Blockchain Workbench のテンプレートが用意されているのでポータルから作成します。仮想マシン、SQL Databases、Web Apps さらにはネットワーク設定も含めて展開をしてくれます。

image.png

2 Azure AD の構成

テンプレートで作成された Web Apps にアクセスすると以下のようなスクリプトが表示されます。こちらを Cloud Shell で実行して設定します。

image.png

実行すると、対象の Azure AD のテナント名も求められますので入力します。Success が出れば成功です。

image.png

次に Azure AD 側でアプリケーションを登録します。登録したアプリケーションのマニュフェストの設定から "appRoles": [] を以下のように編集します。GUID は、[guid]::NewGuid() の Shell などから作成します。

"appRoles": [
     {
       "allowedMemberTypes": [
         "User",
         "Application"
       ],
       "displayName": "Administrator",
       "id": "<A unique GUID>",
       "isEnabled": true,
       "description": "Blockchain Workbench administrator role allows creation of applications, user to role assignments, etc.",
       "value": "Administrator"
     }
   ],

OAuth2 も許可します。

"oauth2AllowImplicitFlow": true,

登録したアプリケーションで以下を設定します。
- 必要なアクセス許可に Microsoft Graph を追加して、Read all user's basic profile を許可します。
- 応答 URL に作成された Web Apps アプリケーションの URL を設定します。

3 アプリケーションの作成

テンプレートから作成された Web Apps のサイトにいくと新規作成のページがあります。
image.png

GitHub のサンプル Hello Blockchain からHelloBlockchain.json と HelloBlockchain.sol を取得します。

New から HelloBlockchain.json と HelloBlockchain.sol を登録するとアプリが登録されました。

image.png

こちらのサンプルは、ブロックチェーンを使用した台帳の Requestor と Responder が必要になります。なので、追加でメインアカウント以外のアカウントも Azure AD に追加しておき、アプリ側で、Requestor と Responder を少なくとも一名追加します。

image.png

Requestor では Take Action からリクエストを登録します。
image.png

Responder では Take Action からリクエストに応答します。

image.png

特にユーザー側でブロックチェーンのハッシュなどに関して認識する必要はないですが、きちんと Block HASH で管理されていることが確認できます。

image.png

ブロックチェーンがこんな簡単に使えるなんてすごいですね。是非お試し下さい。

6
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
1