Challenge 🏆
- 🏆 Chainlink Social Impact Prize on the Chainlink Fall Hackathon 2021
What is Carbolink? 💙
💎 Carbolink is a carbon footprint focused and green-minded project to protect our environment and climate. Carbonlink is built on Ethereum to use LINK.
Inspiration 💡
🌎 Pollution and global warming are really hot topics nowadays. The top leaders of countries make sessions to handle this situation. In this situation people think blockchain is equal to wasting resources, pollution and a big cause of global warming. That’s why we wanted to create a project that would help blockchain to turn a little greener.
🗜 We are freelancer deep learning developers with a strong interest in cutting edge technologies like blockchains and smart contracts.
🌿 Our vision is a world where people are eco-friendly and they use smart contract technology to reduce energy consumption and CO2 footprints to create a healthier and better environment.
What it does ❓
📐 Carbolink helps to measure and calculate the energy consumption and the carbon footprint of different human activities from travelling by airplane, through training a deep learning model till commuting with a gasoline-powered or an electric car.
⏳ Users can start and stop a measurement anytime they want about any activity. A measurement based on time or the spent resources. For example they can measure the carbon footprint of commuting or to work with a computer for 6 hours.
How does it work? ⚙
⚙ As it was mentioned earlier, users can measure and calculate the energy consumption and the carbon footprint of their activities.
Requirements:
✅ ETH wallet with LINK token
✅ Users should know the power consumption of their own devices. We made an API service to provide some data.
✅ Furthermore, for the calculation the smart contract needs the proper ratio of energy production. We also provide this data on a country level.
Steps:
⏰ Time-based measurement:
🟦 set up the device (name, energy consumption)
🟦 add location
🟦 start a measurement
🟦 stop a measurement
🟦 get result
🔬 Consumption-based measurement:
🟪 set up the device (name, energy consumption)
🟪 add location
🟪 set the consumed resources
🟪 get result
Features already implemented:
🟩 constructor(string memory sentence, address oracleAddress, uint256 oracleFee, bytes32 oracleJobId) payable
🟩 function addParentDevice(string calldata message, string calldata name, uint8 status, uint8 consumptionType, uint defaultCPU) onlyAdmin(message) external
🟩 function getParentDeviceById(uint id) onlyExistingParentDevice(id) external view returns (ParentDevice memory)
🟩 function getParentDevices() external view returns (ParentDevice[] memory)
🟩 function changeParentDevice(string calldata message, uint id, string calldata name, uint8 status, uint8 consumptionType, uint defaultCPU) onlyAdmin(message) onlyExistingParentDevice(id) external
🟩 addUserDevice(string calldata customName, uint customCPU, uint parentDeviceId) onlyExistingParentDevice(parentDeviceId) external
🟩 function getUserDevices() external view returns (UserDevice[] memory)
🟩 function changeUserDevice(uint id, string calldata customName, uint customCPU, uint parentDeviceId) onlyExistingUserDevice(id) onlyExistingParentDevice(parentDeviceId) external
🟩 function startTimeMeasure(uint userDeviceId) onlyExistingUserDevice(userDeviceId) external
🟩 function getTimeMeasures() external view returns (TimeMeasure[] memory)
🟩 function stopTimeMeasure(uint measureId) onlyEnoughFee() onlyLivingTimeMeasure(measureId) external payable
🟩 function addUnitMeasure(uint unitCount, uint userDeviceId) onlyEnoughFee() onlyExistingUserDevice(userDeviceId) external payable
🟩 function getUnitMeasures() external view returns (UnitMeasure[] memory)
🟩 function addUserCountry(string calldata countryCode) onlyValidCountryCode(countryCode) external
🟩 function getUserCountry() external view returns (string memory)
🟩 function changeUserCountry(string calldata newCountryCode) onlyValidCountryCode(newCountryCode) external
🟩 function deleteUserCountry() external
🟩 function getCost() external
🟩 function getCost(string calldata countryCode) onlyValidCountryCode(countryCode) external
🟩 function getSourceRates() external
🟩 function getSourceRates(string calldata countryCode) onlyValidCountryCode(countryCode) external
🟩 function fullfill(bytes32 _requestId, bytes calldata _data) recordChainlinkFulfillment(_requestId) public
🟩 function makeApiRequest(string memory endpoint, string memory countryCode) internal
🟩 function validateCountryCode(string memory code) pure internal returns (bool)
🟩 modifier onlyAdmin(string memory sentence)
🟩 modifier onlyEnoughFee()
🟩 modifier onlyExistingParentDevice(uint id)
🟩 modifier onlyExistingUserDevice(uint id)
🟩 modifier onlyLivingTimeMeasure(uint id)
🟩 modifier onlyValidCountryCode(string calldata code)
🟩 event ApiResponseReceived(bytes data)
How we built it 🔨
🧱 There was more steps of the building process. First we figured out what to do and how to implement it. Because smart contracts and on-chain data storage are focused on efficiency we had to figure out how to manage and store data as optimized as possible. There we decided to use old world web services at the user endpoint of our solution. In the future it can get replaced with oracle services. We created the data structure of the project and we decided how to store the data in the smart contract. By building the Solidity code we implemented the classical CRUD data management process for each data type. The functions in the contract are organized by variables and tasks instead of being alphabetically organized. There are five key variables; the array of the predefined parent devices, mappings for time based measurements, for unit based measurements, for countries of the users and for the devices added by the users. The key of the mappings is the address of the users. All key data containers are public. It can be changed in the future if needed but we want to show the transparency of our system.
Challenges we ran into 💪
💪 During the hackathon there were a service maintenance on testnet that made asking faucet a little difficult.
💪 Aside from the maintenance, Chainlink infrastructure is great, we didn’t have any challenges with it. On the other hand it was much more challenging to unify the old world web and web2 solutions with the future-proof web3 technology since static consumption data must be accessible to help the whole process. Chainlink offers oracle services to manage this need, however these ways have some limitations, since they collect bytes32 or value level data only. To handle this limitation we figured out different solutions and we published only one of them now. In the future we can do it in a slightly more optimized way especially since we plan to become oracle at Chainlink.
Accomplishments that we're proud of 😎
😎 deployed a smart contract:
Ethereum Kovan Testnetwork: 0xB01Cb16756b55742fd99611F3799fc7b00829433
Ethereum Rinkeby Testnetwork: 0xB01Cb16756b55742fd99611F3799fc7b00829433
😎 created an API service to help users to reach necessary energy-related data for the measurement: https://hyperrixel.com/hackathon/carbolink/
😎 web based user interface: https://hyperrixel.com/hackathon/carbolink/demo/
What we learned 📘
🧠 We learned a lot about Chainlink’s infrastructure and we learned a lot about carbon footprints of different activities. It is really hard to work on this topic since day by day we get to know new ways how humankind destroys the resources of our planet.
What's next for Carbolink ⏱
🚀 We want to turn our idea into a prosperous service. There are some community and general features that we definitely want to integrate into our solution. Blockchain and smart contract developers are a great community. We think the future should be built on communities. Fighting against pollution and making the world a better place need a lot of devotion. Building social-related projects, like challenges between users, turns hard tasks into fun. We show a way to save our environment but we are open to cooperate with other developers and communities to build better projects. During the hackathon we deployed a smart contract to make the first step on a long and green journey on the Chainlink blockchain.
🟩 optimize the code
🟩 develop our service to become an oracle on Chainlink
🟩 storing results in NFT certificates
🟩 make energy reduction challenges between the users
🟩 establish a new discussion and movement within the blockchain community about the environmental impact of daily activities and how blockchains and smart contracts can help to make daily life more eco-friendly


Log in or sign up for Devpost to join the conversation.