Inspiration
We live in a region rich in wine production and wine culture. Our goal is to develop a protocol that supports trading wine among peers, while helping enthusiasts appreciate and manage their private collections. The web2 incumbents crowd source the market data, and then sell it back to the people who provided it. We think the market data should be a public good, and that there is support for a platform from facilitating the P2P trading and value-adding services like cellaring and delivery when the wine is at it's peak.
It is for three major types of users; (1) wine enthusiasts and private collectors, (2) wine producers, (3) wine storage and cellaring service operators. The goal is to enable private collectors to find out more about the wine they have in their collection including market values.
These groups form an economy that generates valuable information that can help all three groups participate in a vibrant wine trading and service marketplace.
The problem today is that for the enthusiast, good market information is hard to come by, locked, as it is in centralised companies that sells information back to the community that created it.
What it does
At the moment we have created smart contracts to build the public data set and the start of a client app to interact with the contracts. In order to create incentive, people who add on-chain product data will get with equivalent amounts of a project ERC-20 token to the fees they incur adding data.
From a register of bottle types we have utility NFTs that represent, at the moment, self-declared holdings of a particular wine. There can be traded and with more development increase assurances around the existence of the self-declared asset.
The NFTs are dynamic and also rely on some randomness. As time passes the drinking peak of the wine approaches and this is represented on the NFT. As instrumented storage condition information becomes available, the NFT can report on that quality metric as well.
How we built it
We mainly focused on getting contracts published and retrieving data to the front end using GraphQL via Subgraph and the Chainlink AnyAPI pointing to that.
We also mocked the process that automatically retrieves the bottle price data from users and updates the NFT based on the market trend by making use of Chainlink VFR, Automation and DataFeed Services.
Challenges we ran into
It is a big undertaking, so we have a way to go to get to an MVP.
Experience in web2 development got us used to getting answers from Google quickly when overcoming any problems. However, the web3 field has been developed and changed so fast that we cannot secure a solution by just googling. For example, we have said goodbye to Rinkeby, but lots of useful tutorials are still based on it; or some code from 2 years ago already cannot be run under the compiler version now.
When we tried to utilize the Chainlink AnyAPI service, we totally had no idea where to get the JobID we needed. Holding the thought to just give it a try, we joined the Chainlink Discord group and directly asked for it. We have to admit that we didn't expect to get a reply in such a quick time (thanks to Matt and Hanna from Block-Farms.io)
Also we chose NextJS with Typescript as our client. The effort involved in generating ABI types for use in Typescript was frankly, daunting. That impeded progress on the front end. In all likelihood, we'll restart without TypeScript.
Accomplishments that we're proud of
Weijing, co-founder and principal engineer, has stepped into the realm of web3 and learned a lot in the past month!
We got working contracts deployed to Goerli and using scaffold-eth (Thanks Austin!) we were able to exercise them.
We minted the first SwapWineToken NFT collection, which not only reflects the real-world condition of the bottles of wine but also shows a bit of the spectacular scenery of our region (the background of the NFT are inspired by the colours of the sky above local vineyards in different periods of a day).
What we learned
For Weijing, anything web3 from zero: what is blockchain and why web3, how to write code in Solidity, deploy smart contracts on chains, mint NFT...
For the team, we learned quite a bit about how we can emit events and treat that as query-able data without always having to maintain state in the contracts. That helps simplify the contracts and reduce the fees to add data. We learned how Subgraph can help us create an API that can be consumed by the ChainLink AnyAPI service which we can use to manage state in the dynamic NFT. We also learned to use the randomness afforded by Chainlink VRF and automate our contract calls via Chainlink Automation.
What's next for WineSwap / WineVault
Become the peer-to-peer trading marketplace for the world’s wines by implementing
- Private Cellar Management, track your collection referenced to market data
- Option your private wines for buyers to purchase
- Offer to buy specific wines
- Cellar storage as a service
- Take delivery when wine is at it’s drinking peak
- E-Commerce style delivery of goods
- Securely store wines as a cellaring service and ship to the owner when requested
- Community Discord and deals for NFT holders.
- Fully decentralised, non-fungible token (NFT) asset ownership
- NFT marketplace for direct peer-to-peer asset exchange
- Market data information via GraphQL and ChainLink feeds
- Escrow for deals between unknown parties
- Staking mechanisms to incentivise policy compliance
- In-market, tradeable loyalty points through fungible token (ERC20)
- Built on Optimism Layer2 EVM blockchain protocol
Built With
- anyapi
- chainlinkautomation
- graphql
- nextjs
- remix
- scaffold-eth
- solidity
- subgraph
- typescript
- vrf

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