A fully functioning fortune telling service on the Ethereum blockchain with user interface!
Try it here (MetaMask plugin for Chrome required to access Ethereum smart contract/Web3):
http://eching-env.aabcm7kmvi.us-east-2.elasticbeanstalk.com/
Inspiration
One of the most popular books of all time and one of (if not the oldest) continually in-print book known to man, the I Ching is a method of divination (fortune telling) that uses more or less random numbers (cleromancy) to determine something called a "hexagram" a figure consisting of six symbolic lines. There are 64 hexagrams in the I Ching system, and each one represents, essentially, a psychological archetype. By pondering a question, calculating the numbers/lines of the hexagram, and meditating during the process, the I Ching is supposed to provide insight into your query based on non-temporal, hyperdimensional source wisdom. In a more grounded sense, the 64 hexagrams are full of insightful prose that even if you were to simply read each hexagram description in order without any random generation, would lead to introspection and wisdom. They are thoughtful and engaging texts that are useful from a philosophical point of view, regardless of the mystical-random calculation used to access them.
There is only one app in the world that uses the traditional (1,000+ year old) statistical distribution of lines. There are apps that use modern methods for calculating lines but they have different odds of outputting certain lines than they should. This app uses a more authentic method for calculating hexagrams, which sets it apart from other apps that currently exist. This is the first to ever utilize a blockchain to host the function.
What it does
This dApp uses the Ethereum World Computer to calculate lines/hexagrams and retrieve magical wisdom from the ether (in the metaphysical sense). The dApp accesses the blockchain using Metamask (and Web3 framework) and then outputs the divinatory result in a visually pleasing manner. The number of the hexagram(s) drawn are listed and can be referenced in one of the many print/online I Ching sources to determine its meaning. Metamask is used to access the Ropsten test network and the smart contract hosted there. A pseudo-random number is generated based on the question submitted and other features of the blockchain at a given moment.
There are four types of lines used to build a hexagram. Yin lines (which are a broken line like --- ---) yang lines (which are solid like -------) and then changing yin and changing yang lines. These changing lines, if they occur in a reading, indicate that after the first hexagram is calculated, a second hexagram should be drawn wherein all of the "changing" lines from the original hexagram have been flipped to the opposite type. These two hexagrams are reviewed together, and particular importance is supposed to be given to the meaning of the changing lines.
In modern times the most common way to calculate the lines is by flipping three coins. This method is convenient if you are hoping to glean some wisdom on the fly, but unfortunately leads to an even distribution of likelihood for any of the four line types. In the ancient methodology of calculating the hexagrams, 50 plant stalks were manipulated by hand while the question was meditated on. It turns out that the odds of getting any of the four line types is very different based on this method, and the likelihood of returning any given line is philosophically meaningful. More on this can be read on the wikipedia page for i ching divination. https://en.wikipedia.org/wiki/I_Ching_divination
This app simply takes the more traditional and allegedly more authentic distribution of line likelihood to determine the output. In a system of divination which requires both a suspension of logical thought and a type of mystical superstition, something as arbitrary and minuscule as the math used in the calculation can play an important mental/spiritual role. As far as having faith in what is essentially magic, sticking to some more interesting and "ancient" calculation method will only make you feel that the output has some greater value, I think. There are many apps that calculate hexagrams for the PC and handheld devices, but to my knowledge there is only one that uses this traditional distribution, and it is somewhat clunky.
Since an oracle is a technical term related to blockchains, I thought it would be charming to create a blockchain oracle in the mystical sense of the word. It will exist as long as the blockchain does, accessible as an abstract source of inspiration and epiphany for anyone, forever.
How I built it
The math behind the calculation is relatively simple. It is programmed using Solidity and runs on the Ethereum network, in the browser demo it uses Web3 and Metamask for the frontend (plus html and css). Some algorithms and simple image files output the final hexagram in an easy, human-readable way. All of this is hosted on a server running node.js. Without the front end the contract can still be accessed directly on the blockchain but a user will have to take the line-number outputs and draw the accompanying hexagram themselves. Ideally the whole site will be hosted on IPFS, but due to time constraints only the contract may be hosted on a distributed network, with the rest of the back/frontend hosted on a traditional server.
View the contract (and bytecode) directly using a blockchain explorer: https://ropsten.etherscan.io/address/0xf69fda67fa2c692532607b5cfc785b81e63b2801
Access it using MEW (make sure you select Ropsten network) https://www.myetherwallet.com/#contracts contract address: 0xF69FDA67fA2C692532607b5cfc785b81e63b2801
ABI [{"constant":true,"inputs":[{"name":"_question","type":"string"}],"name":"cast","outputs":[{"name":"","type":"uint256[]"}],"payable":false,"stateMutability":"view","type":"function"}]
Accessing it directly does not have a UI so you have to calculate the lines yourself (building the hexagram from the bottom up)
cast() function will return 6 numbers from 6 to 9 Where 6 is Old yin (broken line changing to solid), 8 is Young yang, 9 is Young yin, 7 is Old yang (solid line changing to broken)
I highly recommend you use the finished demo with UI! See link!
Challenges I ran into
Having the contract successfully output changing lines as well as the simple initial hexagram was difficult and required explicit defining of all 64 hexagrams.
Accomplishments that I'm proud of
I think that an authentic calculation of the I Ching hexagrams is useful and now there is an essentially free way to access this information forever on the Ethereum computer.
What I learned
Even a simple idea takes time to implement.
https://en.wikipedia.org/wiki/Cleromancy
What's next for eChing
I would like to host it on IPFS so that it can continue indefinitely. It would also be interesting to host it as its own standalone app, or as a Status.im dapp.


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