Inspiration

We were curious about how a web3 application works and how it is built. Furthermore, we had a lot of fun developing it together and learn new things.

What it does

The Project Ocean Race is all about weather data, navigation and sailing. Our boat sails a race from Hamburg to New York. It is the challenge for the skipper to find the fastest course to the destination based on the weather conditions.

For the current position of the sailing boat, the weather data (wind speed and wind direction) are imported regularly, for example every hour. The speed is calculated from the course of the boat and the weather data (wind speed and wind direction) and the new position of the boat is determined.

The player / skipper determines the sailing direction of the sailing boat. The speed of the boat is calculated from the angle of course and wind and the wind speed. The player adjusts the course of the boats according to the current weather conditions to reach the destination in an optimal time.

How we built it

  • Backend: functions-hardhat-starter-kit for SmartContract and Chainlink Functions

The OceanRace.sol is holding the position and direction of the boat. The Chainlink function retrieves the current weather data via the API and calculates the new position of the boat.

  • Frontend: React, wagmi, googlemaps :

We use React as our framework for the frontend. Communication with SmartContract is mapped via the wagmi library. googelmaps shows the actual position of the boat and is also the input to set the new direction of the boat by the player.

Challenges we ran into

First we wanted to set up a real race with several competitive boats. The complexity however, in the end it was too big for our programming skills and the time available, so we could only launch one boat.

  • Parameter transfer between SmartContract and Chainlinkfunction
  • Different behavior and troublesome debugging between Local Dev - Testnet polygon Mumbai
  • Hairy Math to move from one point to another on the globe

Accomplishments that we're proud of

We created a working dapp that reads and writes data on the blockchain and found a solution for the math around Navigation, to find the new position depending on the weather conditions and bearing of the boat.

What we learned

  • How to develop with Chainlink Functions, React using wagmi, googlemaps and Solidity
  • Navigation

What's next for Ocean Race

  • beautify, cleanup and optimization
  • to have several boats at the start for a real competition.
  • indexing the previous positions in the contract to show the route of the boat
  • automate the chainlink function

Built With

Share this project:

Updates