Skip to content

steftroubadour/yi-king

Repository files navigation

codecov

Yi Jing 易经

A blockchain implementation of I Ching divination.

https://en.wikipedia.org/wiki/I_Ching

Yi Jing

nft_image

dApp on Vercel

Description

Use Blockchain to store information for eternity.

Features

Smart contracts on EVM

  • written in Solidity for EVM
  • Stored information must be easily readable and on-the-same-chain.
  • Contracts, except core NFT contract, must be upgradable
  • Encrypt information
  • Retrieve different image / metadata versions.
  • Have a low gas fee at mint.

dApp

NFT ERC-721

The draw result of I Ching divination is store as an NFT

metadata

  • image: animated SVG store on-the-same-chain (not on IPFS or on other chain)
  • message: json with name & question. Can be stored encrypted.
  • is message encrypted: true / false

if encrypted message

  • to remember how to decrypt the message

image version

  • add version management for metadata / image, tokenURI(tokenID, version)

random function is external

Possibility to change getNumbers() in a new contract. Note : random could be render locally.

Support affiliation

An affiliate must earn revenues publishing

Affiliate integration

make an easy IFrame integration for any website page.

Support non custodial wallet

Add the possibility to new Blockchain users, to create an account, pay with card & have a non-custodial wallet see web3auth.io

Tech specifications

Smart contracts

Development use Solidity language and Foundry

Random contract

Random will be used on-chain

Image contract

image is an animated svg and can have multiple versions

NFT contract

draw will be save on-chain in an NFT

  • erc721
  • metadata and image are on-the-same-chain
  • image is read from previous contract
  • must have a specific tokenURI to retrieve specific image version

Affiliation contract

To share benefits from mint with affiliated

  • add/remove affiliate member
  • member has address and percent retribution in basis point (bp)

Contracts addresses

Ethereum Testnet Sepolia (11155111)

Contract Name Address
NFT 0x58e966f7CB649806cAE4135e32f5842A0Dc8a034
Metadata 0x8C7b569CfECc0264CDFB1590B66bf990B7B86Bc9
Image 0xEdFcEF085C78592Efc0E361540c42A6583C3673A
Affiliation 0x799d2d814f39727966a59461f4A7c4630AD7eCC2
Random 0x267e415EBa5a62929F01c758503B0668E03A99D8

Polygon Testnet Mumbai (80001)

Contract Name Address
NFT 0x33a0FD74321dD4EA3db91277AEf379cd297191ed
Metadata 0x58e966f7CB649806cAE4135e32f5842A0Dc8a034
Image 0x799d2d814f39727966a59461f4A7c4630AD7eCC2
Affiliation 0x8C7b569CfECc0264CDFB1590B66bf990B7B86Bc9
Random 0xEdFcEF085C78592Efc0E361540c42A6583C3673A

FLOW

Random draw, first hexagram

By writing your name or pseudonym and a well-chosen question, we can consider the intention to be fixed. To have the first hexagram call for Yi Jing divination, we use randomness, assuming that the random hexagram result is equal to the yarrow-stalk method or coins method results. The randomness is on-chain, but it could be generated by the server. The usage of on-chain VRF like Chainlink VRF is not used because it is not necessary.

first hexagram

hexagram

from hexagram (the present, how it is now)

from

to hexagram (how that could be)

to

Mint the NFT

To save draw, pseudo & question for eternity, we mint an NFT

pseudo & question

There is no on-chain solution to encrypt data on-chain. By now, solution is to encrypt the message by yourself. For example, using elliptic curve consuming to much gas in EVM. Solution can be find in other non-EVM blockchains or layers 2.

You can mint on Sepolia and Mumbai testnets

Get free tokens to test:

https://sepoliafaucet.com/

https://mumbaifaucet.com/

nft_image