arrow_back

Visualize the 10,000 Bitcoin Pizza Transaction Using BigQuery and Vertex AI Workbench

Join Sign in

Visualize the 10,000 Bitcoin Pizza Transaction Using BigQuery and Vertex AI Workbench

1 hour 1 Credit

GSP604

Google Cloud self-paced labs logo

Overview

This lab reviews the bitcoin transactions tied to the infamous 10,000 bitcoin pizza purchase.

This code is based on code originally written by Allen Day and modified by Sohien Dane and Meg Risdal from these Kaggle kernels (parts 1, 2, 3). You use it to visualize a directed graph representing Bitcoin transactions that follow the first known exchange of Bitcoin for goods on May 17, 2010 made by Laszlo Hanyecz.

You will use a Vertex AI Workbench instance to:

  1. Retrieve as many transactions as possible from BigQuery within 2 degrees of separation from the pizza exchange.

  2. Post-process the transactions to remove excess transactions from step 1 because the query was overly-greedy to ensure the number of table scans equals the degrees of separation.

  3. Visualize the directed graph.

Setup and requirements

Before you click the Start Lab button

Read these instructions. Labs are timed and you cannot pause them. The timer, which starts when you click Start Lab, shows how long Google Cloud resources will be made available to you.

This hands-on lab lets you do the lab activities yourself in a real cloud environment, not in a simulation or demo environment. It does so by giving you new, temporary credentials that you use to sign in and access Google Cloud for the duration of the lab.

To complete this lab, you need:

  • Access to a standard internet browser (Chrome browser recommended).
Note: Use an Incognito or private browser window to run this lab. This prevents any conflicts between your personal account and the Student account, which may cause extra charges incurred to your personal account.
  • Time to complete the lab---remember, once you start, you cannot pause a lab.
Note: If you already have your own personal Google Cloud account or project, do not use it for this lab to avoid extra charges to your account.

How to start your lab and sign in to the Google Cloud Console

  1. Click the Start Lab button. If you need to pay for the lab, a pop-up opens for you to select your payment method. On the left is the Lab Details panel with the following:

    • The Open Google Console button
    • Time remaining
    • The temporary credentials that you must use for this lab
    • Other information, if needed, to step through this lab
  2. Click Open Google Console. The lab spins up resources, and then opens another tab that shows the Sign in page.

    Tip: Arrange the tabs in separate windows, side-by-side.

    Note: If you see the Choose an account dialog, click Use Another Account.
  3. If necessary, copy the Username from the Lab Details panel and paste it into the Sign in dialog. Click Next.

  4. Copy the Password from the Lab Details panel and paste it into the Welcome dialog. Click Next.

    Important: You must use the credentials from the left panel. Do not use your Google Cloud Skills Boost credentials. Note: Using your own Google Cloud account for this lab may incur extra charges.
  5. Click through the subsequent pages:

    • Accept the terms and conditions.
    • Do not add recovery options or two-factor authentication (because this is a temporary account).
    • Do not sign up for free trials.

After a few moments, the Cloud Console opens in this tab.

Note: You can view the menu with a list of Google Cloud Products and Services by clicking the Navigation menu at the top-left. Navigation menu icon

Task 1. Launch Vertex Workbench Notebook

To create and launch a Vertex AI Workbench notebook:

  1. In the Navigation Menu Navigation menu icon, click Vertex AI > Workbench.

  2. On the Workbench page, click New Notebook.

  3. In the Customize instance menu, select TensorFlow Enterprise and choose the latest version of TensorFlow Enterprise 2.x (with LTS) > Without GPUs.

  4. Name the notebook.

  5. Set Region to and Zone to any zone within the designated region.

  6. In the Notebook properties, click the pencil icon pencil icon to edit the instance properties.

  7. Scroll down to Machine configuration and select e2-standard-2 for Machine type.

  8. Leave the remaining fields at their default and click Create.

After a few minutes, the Workbench page lists your instance, followed by Open JupyterLab.

  1. Click Open JupyterLab to open JupyterLab in a new tab.

Wait for the notebook instance to start, this takes a few minutes.

Click Check my progress to verify the objective. Create the Notebook instance

Task 2. Load the data

To clone the training-data-analyst repository in your JupyterLab instance:

  1. In JupyterLab, click the Terminal icon to open a new terminal.

Open Terminal

  1. At the command-line prompt, type the following command and press ENTER:

git clone https://github.com/GoogleCloudPlatform/training-data-analyst
  1. To confirm that you have cloned the repository, in the left panel, double click the training-data-analyst folder to see its contents.

Files in the training-data-analyst directory

Wait for the cloning to complete.

Task 3. Open the notebook

  1. Open training-data-analyst > blogs > bitcoin_network > visualizing_the_10000_pizza_bitcoin_network.ipynb.

  2. In the notebook interface, click on Edit > Clear All Outputs.

  3. Read through the notebook and execute the code to perform the data extraction, cleanup, and visualization.

Click Check my progress to verify the objective. Load the notebook

Congratulations!

You have seen how you can deploy Vertex AI Workspace notebooks in Google Cloud and retrieve BigQuery data from within a notebook.

Manual Last Updated September 27, 2022

Lab Last Tested September 23, 2022

Copyright 2022 Google LLC All rights reserved. Google and the Google logo are trademarks of Google LLC. All other company and product names may be trademarks of the respective companies with which they are associated.