Collecting good quality data is a demanding process. It requires proper planning, reliable tools and a robust methodology. As a result, it is not surprising that organizations would prefer to keep their data private and only share it with a select few or those willing to pay to access it.
Where does one store valuable data such as the noise data we have collected in order to make it publicly available for everyone to access without any gatekeeper or storage restrictions?
This is where the Blockchain comes in.
In this article, I will go over how the acoustic data we collected on SkyTrain has been deployed to the Blockchain and how it can be accessed through smart contracts.
First things first, let’s go over some core concepts.
The Internet as we know it today is referred to as Web2. This implies centralized platforms and services managed by a few major corporations. On the other hand, Web3 envisions a decentralized Internet where control is distributed amongst users of a technology: the Blockchain. Open Data refers to the idea that Data should be shared and made freely available to anyone without any restrictions. However, some organizations claim to offer access to Open Data while still requiring users to create an account, or submit a short summary of their intentions before they can be granted access to the data. This goes against the core concept of Open Data. There is one more concept that needs to be discussed before moving on. Smart Contracts are pieces of code that have the capability to store information. To be useful, a smart contract needs to be deployed to the Blockchain and is stored in one of the blocks that make up the Blockchain. This is what a Smart Contract looks like.
Once ready, the Smart Contract is deployed to one of many chains that make up the Blockchain. We have chosen Sepolia RPC https://chainlist.org/chain/11155111. The Smart Contract is stored in one of the Blocks that then gets appended to the Sepolia Chain and is assigned the following address 0x18e049b8181cb331c7a36d0dceb6e2bb04323793. If you click here, you will find the details of the contract on the Blockchain.
Now that the Smart Contract is on the Blockchain, let’s access the information that is stored inside. If you are feeling adventurous and want to put your coding skills to the test, you can use the web3 library and programmatically access the content of the smart contract by using the contract address above and the following abi. ABI defines the structure of the data contained in a smart contract. It outlines the functions that can be accessed and the type of data that each function returns.
Below is an example of how to use the web3 library in Python
And here is how to interact with the 3 functions: Calling the getOverview function returns a short set of instructions in a string format. The instructions cover what the data consists of and why it was collected.
Calling the getDataStructure function returns a string which must then be converted into a dictionary to properly explore the nature and format of each key and value present in the data.
Calling the getNoiseData function returns the data in a string format which then must be converted into a dictionary using the json library.
The table below shows the data available in the Smart Contract. These metrics summarize the noise data captured during each of the 107 surveys.
Deploying Smart Contracts is not free. In order for our Smart Contract to become part of the Blockchain, it cost $218.00 Canadian or 0.05803877 ETH. This transaction fee, also known as gas fees, fluctuates depending on the computational resources required to deploy the Smart Contract. It is used to compensate for the nodes of the network that make it possible for the Smart Contract to become part of Sepolia RPC. However, interacting with the Blockchain without making any changes is free.
The Blockchain has helped give Open Data its true meaning by allowing us to share and access data freely without any gatekeepers while ensuring that the data integrity is guaranteed. While the concept of the Blockchain remains fairly new and still needs to overcome scalability challenges, it is without any doubt a technology with which we will eventually have to learn to interact.