Closed learner-long-life closed 4 years ago
Issue Status: 1. Open 2. Started 3. Submitted 4. Done
This issue now has a funding of 25.0 DAI (25.0 USD @ $1.0/DAI) attached to it as part of the invisible-college fund.
Hi @acolytec3 thanks for applying. I liked your work on the Eth 2.0 client architecture and some gitcoin devops scripts. Can you post some examples of your past react / web3 work?
@cryptogoth see Arwen. I built it for a hackathon last year. You can see the demo app here. Most of the other web3 work I've done has been in Python and Dart (most recently).
Also, a little older but I built a very basic react-based block explorer for a personal blockchain project.
Very cool @acolytec3 you're approved to start. Let me know if you have any questions or feedback here, or for sidechatter / talk about past / future bounties, you can join our gitter channel
@ashline thanks for your interest. I've given the go-ahead to @acolytec3 for this task, but you are welcome to give it a go just for learning. Walk through the steps of the task until the very end, and feel free to join us in our gitter channel
I'll post more bounties in the future, and your questions will give me a better sense of what a contribution would be a good fit.
@acolytec3 Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!
Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days
@gitcoinbot Yes, been looking at it. Will put more focus on it this weekend.
Issue Status: 1. Open 2. Cancelled
Workers have applied to start work.
These users each claimed they can complete the work by 2 weeks, 2 days ago. Please review their action plans below:
1) owonwo has applied to start work _(Funders only: approve worker | reject worker)_.
I've gone through it. I'll following the steps as stated and shall fix this issue. :smiles: 2) linggar155 has applied to start work _(Funders only: approve worker | reject worker)_.
Confirm admin , Iwant to work
Learn more on the Gitcoin Issue Details page.
@cryptogoth Should i add https://immerjs.github.io/immer/ to the project. I need to update state immutably.
@cryptogoth I followed the instructions as given. Every ZK Token address returns zero notes. What do i do about it?
Now am getting this error.
@cryptogoth Should i add https://immerjs.github.io/immer/ to the project. I need to update state immutably.
Good point. You'll need to add the module immutable
, which has source code here:
https://github.com/immutable-js/immutable-js
Since we use yarn
in our project, you would run
yarn add immutable --save
Merged as #49
Background
This task is part of a larger project to create an interactive web demo / playground for users to learn about zero-knowledge (ZK) assets and gain intuition about them by directly transacting with the contracts on-chain.
Your task is to implement the part of the static site that is currently hard-coded to display fake balances of ZK tokens.
Task Description and Examples
A static demo, created with
react-scripts
, not connected to the blockchain, is currently running on: https://zk-transfer.netlify.comAfter this task, you will connect this demo to read from the Rinkeby testnet.
with source code in this directory: https://github.com/invisible-college/democracy/tree/master/packages/zk-transfer-web
Your task has two parts:
The page only has to display the correct balances when it is refreshed. In a later task, we'll add the ability to listen to changes from the blockchain and auto-update.
We also use
Immutable.js
everywhere instead of regular JSON maps and lists because of the benefits of immutability (fewer programming errors / unintended side effects, as well as the ability to see historical snapshots of data).immutable.List
andimmutable.Map
are available in the webpage, and on the web console, usingdemo.immutable.List
anddemo.immutable.Map
.You can read more at the official Immutable.js documentation.
How to Work on This Task
Working on this task requires the following steps
These steps are described in more detail below:
Get Balance From a Rinkeby Account
To mint new ZK notes, we've created an Ethereum account on the Rinkeby testnet for you to use, with these credentials.
You'll use these below.
Minting Through a Website
Navigate to this page to view your balance and perform minting through a web interface: https://aztec-web.netlify.com
The source code for this page, which you may find helpful later because it shows how to work with AZTEC notes using Democracy.js, is located at https://github.com/invisible-college/democracy/tree/master/packages/aztec-web
It will take a few seconds, as Democracy.js wallet loading is currently slow. You can open the web inspector to see its progress.
In the
Login Book
, enter the credentials above and clickRetrieve
. After a second or two, you should see this new address added, with a balance of about 2.8 ETH (rinkeby ether). If this goes to zero, you can refill it by following the instructions at the Rinkeby faucetIn the
Address Book
, click the address / public key pair there, which is the auto-created Democracy.js address for you in localStorage.In the bottom part, you'll find three tokens, with symbols
AAA
,BBB
, andABC
. In each one, you can type a number into the blank, hitMint
, and watch the web inspector to see it get mined.After waiting for about 15 seconds without seeing an error, you'll know the note was created. (I know, we need better user feedback).
You can refresh the page now, and see the new notes at the bottom, under the appropriate token, drawn as colored rectangles.
Minting Through Command-Line
To mint through the command-line, and even create new tokens, clone the source code and set up your development environment using these instructions: https://github.com/invisible-college/democracy#get-the-source-code-to-experiment-and-run-tests
Then run the following commands
You can copy the ethereum address and AZTEC public key for your Democracy.js account from the web UI above, in the
Address Book
section.Retrieve a List of Tokens in React
You'll perform this task in the
packages/zk-transfer-web
directory, but using these line inaztec-web
, which you can interact with using the web console at https://aztec-web.netlify.comAfter Democracy.js has initialized in
zk-transfer-web
, you can explore thedemo
andapi
global symbols.To verify that you are using Rinkeby, you can type
To retrieve the list of ZK tokens, access
The result is an
Immutable.js
Map, which you can iterate usingor convert to a JSON object, for easy printing on the web console
You usually do not have to do the
.toJS
part while you are programming in React.Its keys are deploy names, which all begin with
ZkAssetTradeable
(the Ethereum contract name) and end indeployXYZ
whereXYZ
is the trading symbol of the token. To access the token information forAAA
, you evaluteThe values are also an Immutable Map, the most important one is called
deployAddress
which tells you the Ethereum address where that token is deployed. To access thedeployAddress
of tokenAAA
, you evaluate:Retrieving ZK Notes with Democracy
The last piece of information you'll need to print out the balances of each ZK token is the list of notes. You can use these lines from
aztec-web
, which produce an Immutable Map at https://aztec-web.netlify.com which you can interact with using the web console.with keys being the token address, and the values being an Immutable List of notes.
For example, once you've found all the token addresses above, you can retrieve the list of notes for that token as
To iterate over all the notes
Deploying to Netlify
When you create your pull request of your fork back to the base repo, Netlify will include a preview deploy.
Looking forward to working with you on this project.