EthereumEthereum
0x85...0e12

ELS Listing V1

ELS-LIST-V1

收藏品
大小
37
收藏品
所有者
9
24% 独特的所有者

ELS Listing V1 28

收藏
所属者
0xEd...F684
Ethereum
0xEd...F684
Ethereum
描述
<h2>0. Introduction</h2><p>As we approach EthCC, we were&nbsp;<a href="https://twitter.com/HyperOracle/status/1666945655913463809" rel="noopener noreferrer" target="_blank">giving away one ticket</a>&nbsp;to the lucky winner of our raffle.</p><p class="ql-align-center"><span style="color: transparent;"><img src="https://mirror.xyz/_next/image?url=https%3A%2F%2Fimages.mirror-media.xyz%2Fpublication-images%2FCd-ylS0wnm0weQdjYyL8v.png&amp;w=3840&amp;q=75" height="965" width="1183"></span></p><p>At the same time, we realized that this was a great opportunity to show what a builder can do with Hyper Oracle.</p><p>In this post, we will demonstrate the full application flow that draws one raffle winner based on Hyper Oracle’s stack, featuring Ethereum smart contracts and Hyper Oracle zkGraph.</p><p>You can check out the source code and links shown in the explorer here:&nbsp;<a href="https://gist.github.com/fewwwww/472a08039680bf6c79d5379c8533a2fd" rel="noopener noreferrer" target="_blank">https://gist.github.com/fewwwww/472a08039680bf6c79d5379c8533a2fd</a>.</p><h2>1. Develop and Deploy Smart Contract</h2><p>In order for zkGraph to implement the random number generation computation, we need to first place the data on chain.</p><p>We start by developing a basic smart contract. The core component of the contract emits an event, containing the seed of the random number we have just entered.</p><p class="ql-align-center"><span style="color: transparent;"><img src="https://mirror.xyz/_next/image?url=https%3A%2F%2Fimages.mirror-media.xyz%2Fpublication-images%2F3V55MtY7B1WJTYql6-8rh.png&amp;w=3840&amp;q=75" height="1440" width="2560"></span></p><p>We then deploy the contract directly to Ethereum mainnet (<a href="https://etherscan.io/address/0x65747849e7033cd1da6bf5aeb753460f61743b18" rel="noopener noreferrer" target="_blank">0x65747849E7033cd1da6bF5Aeb753460F61743B18</a>). Once deployed, we seed the random number (in our case, we input the number of retweets) into the smart contract by calling a function on the smart contract.</p><p class="ql-align-center"><span style="color: transparent;"><img src="https://mirror.xyz/_next/image?url=https%3A%2F%2Fimages.mirror-media.xyz%2Fpublication-images%2FQli3SyScqN1qaQBZDcGF8.png&amp;w=3840&amp;q=75" height="1440" width="2560"></span></p><p>This&nbsp;<a href="https://etherscan.io/tx/0x5c6d0acadf750dc7d6a1c7f70c343d9c2b41b541ae9341ff192f5fa1fa28832c" rel="noopener noreferrer" target="_blank">transaction</a>&nbsp;emits the number we entered as event data. You can see the data of the event of the transaction we just sent in the blockchain explorer.</p><p class="ql-align-center"><span style="color: transparent;"><img src="https://mirror.xyz/_next/image?url=https%3A%2F%2Fimages.mirror-media.xyz%2Fpublication-images%2F81Ttx98AMlTHzXgBuUSfN.png&amp;w=3840&amp;q=75" height="1428" width="2560"></span></p><h2>2. Develop zkGraph</h2><p>Since we now know the transaction hash of the event on the Ethereum chain, we need to write a handleEvent function in zkGraph to process the event data.</p><p class="ql-align-center"><span style="color: transparent;"><img src="https://mirror.xyz/_next/image?url=https%3A%2F%2Fimages.mirror-media.xyz%2Fpublication-images%2FJ5ftM4a9xXlnxL3M_QB4w.png&amp;w=3840&amp;q=75" height="946" width="1600"></span></p><p>In our handleEvent code, there are three main sections:</p><ul><li>Get the data from the blockchain event</li><li>Randomize the data</li><li>Output the randomized result</li></ul><p>For data randomization, we add a layer of complexity by throwing today’s date and time into the mix. Throughout the zkGraph development process, developers are free to program more complex and sophisticated operations: indexing, automation, and even machine learning!</p><p>Take this example as a simple form of demonstration of what you can do with zkGraph. In the final stage, we deploy this zkGraph, make it executable, and generate zero-knowledge proofs!</p><h2>3. Deploy, Run, and Prove</h2><p><a href="https://www.hyperoracle.io/app/mvp" rel="noopener noreferrer" target="_blank">Hyper Oracle's MVP</a>&nbsp;is a straightforward studio for developers to write zkGraph code with libraries and deploy it, among other things.</p><p>For using the MVP, you can check out our&nbsp;<a href="https://docs.hyperoracle.io/mvp/testing-guide" rel="noopener noreferrer" target="_blank">MVP testing guide</a>.</p><h3>a) Set Up zkGraph</h3><p>We paste the zkGraph code we just wrote into the code editor in the MVP, and enter the appropriate Source Contract Address, and Source Event Name on the right side.</p><p class="ql-align-center"><span style="color: transparent;"><img src="https://mirror.xyz/_next/image?url=https%3A%2F%2Fimages.mirror-media.xyz%2Fpublication-images%2FXm73HLhwILMrGeVFenR1o.png&amp;w=3840&amp;q=75" height="1428" width="2560"></span></p><p>Next, we use the code editor to generate the compiled WASM code and click "SET UP" to&nbsp;<a href="https://zkwasm-explorer.delphinuslab.com/task/649007dff0e3eee93f5fa123" rel="noopener noreferrer" target="_blank">deploy it to our node</a>.</p><p class="ql-align-center"><span style="color: transparent;"><img src="https://mirror.xyz/_next/image?url=https%3A%2F%2Fimages.mirror-media.xyz%2Fpublication-images%2F7fWzA89rUByzfOPkyK4Ux.png&amp;w=3840&amp;q=75" height="1426" width="2560"></span></p><h3>b) Execute zkGraph and Generate ZK Proof</h3><p>After entering the correct transaction hash (the one we emitted the event with), we can perform the computation of zkGraph and generate&nbsp;<a href="https://zkwasm-explorer.delphinuslab.com/task/649008e4f0e3eee93f5fa1dd" rel="noopener noreferrer" target="_blank">a zero-knowledge proof for its computation</a>!</p><p class="ql-align-center"><span style="color: transparent;"><img src="https://mirror.xyz/_next/image?url=https%3A%2F%2Fimages.mirror-media.xyz%2Fpublication-images%2FpwIMay2_26HAyznb83z_J.png&amp;w=3840&amp;q=75" height="1427" width="2560"></span></p><p>We can see that we have arrived at the final winner of the drawing, which is the 9th member shown in the Output State data.</p><h3>c) Verify zkGraph On-chain</h3><p>As the last step, we deploy an&nbsp;<a href="https://zkwasm-explorer.delphinuslab.com/task/64900e32f0e3eee93f5fa495" rel="noopener noreferrer" target="_blank">on-chain verifier smart contract</a>&nbsp;to verify the zero-knowledge proofs. This is to attest the execution is correct and therefore the raffle output is drawn according to the code in the zkGraph.</p><p class="ql-align-center"><span style="color: transparent;"><img src="https://mirror.xyz/_next/image?url=https%3A%2F%2Fimages.mirror-media.xyz%2Fpublication-images%2FJ8SHsQmNLgUkXOGhJQXXW.png&amp;w=3840&amp;q=75" height="1429" width="2560"></span></p><h3>4. Build a zkGraph with Hyper Oracle</h3><p>This is the entire process of building an application with Hyper Oracle and zkGraph.</p><p>In a real world example, the entire development process might be:</p><ul><li>Simpler: Because you probably don't need to build a new smart contract or a new zkGraph, but rather take advantage of the blockchain and the ecosystem and open source nature of the Hyper Oracle network.</li><li>More complex: You can build more complex computations (including machine learning) without worrying about the security and integrity of the computation, because all computations can be flexibly generated with zero-knowledge proofs.</li></ul><p>Start building zkGraph now!</p><p>We'd love to hear how you are currently automating smart contracts and what features you'd like to use. Therefore we have created a short dev survey to better understand your needs and how we can tailor our product to suit your requirements.</p><p><a href="https://docs.google.com/forms/d/e/1FAIpQLSeY_m-hwDyIUv2iaBBTwOvVBtJVnDAAzr92zvQuoNXH46nDlA/viewform" rel="noopener noreferrer" target="_blank" style="color: rgba(var(--foreground), var(--shadeTextSecondary));"><img src="https://lh4.googleusercontent.com/Zyhdl2eFuXBJ6yCy7TywlEA4Qe07NsdGX3iOkElRwS4aLM8ORQYj48yaUeUdPHHtfvSPa2Lw9g0=w1200-h630-p" alt="zkAutomation Dev Survey"></a></p><p><a href="https://docs.google.com/forms/d/e/1FAIpQLSeY_m-hwDyIUv2iaBBTwOvVBtJVnDAAzr92zvQuoNXH46nDlA/viewform" rel="noopener noreferrer" target="_blank" style="color: rgba(var(--foreground), var(--shadeTextSecondary));">zkAutomation Dev Survey</a></p><p><a href="https://docs.google.com/forms/d/e/1FAIpQLSeY_m-hwDyIUv2iaBBTwOvVBtJVnDAAzr92zvQuoNXH46nDlA/viewform" rel="noopener noreferrer" target="_blank" style="color: rgba(var(--foreground), var(--shadeTextSecondary));">Hyper Oracle is releasing zkGraph and zkAutomation this summer! Our zkGraph is a program that accepts custom logic written in hi…</a></p><p><a href="https://docs.google.com/forms/d/e/1FAIpQLSeY_m-hwDyIUv2iaBBTwOvVBtJVnDAAzr92zvQuoNXH46nDlA/viewform" rel="noopener noreferrer" target="_blank" style="color: rgba(var(--foreground), var(--shadeTextSecondary));">docs.google.com</a></p><p>Follow us on&nbsp;<a href="http://www.twitter.com/hyperoracle" rel="noopener noreferrer" target="_blank">Twitter</a>&nbsp;and join our&nbsp;<a href="https://discord.gg/PW3Ncdvu" rel="noopener noreferrer" target="_blank">Discord</a>&nbsp;to stay up to date with Hyper Oracle. Learn more about Hyper Oracle on our&nbsp;<a href="http://www.hyperoracle.io/" rel="noopener noreferrer" target="_blank">website</a>.</p>
详情
代币 ID
28
网络
Ethereum
标准
ERC721