On chain state transition remix
Remix
-
Connect yout Metamask wallet to Polygon Mumbai Testnet.
-
On the Remix Homepage, click "Load from GitHub" and import
State.sol
using the link: https://github.com/iden3/contracts/blob/master/contracts/State.sol -
Move to the "Solidity Compiler" section and compile
State.sol
. -
Move to the "Deploy and Run Transaction" section and modify the Environment to "Injected web3". If everything was set correctly, you should see
Custom (80001) network
below the environment drop-down menu.The system prompts you to connect to your MetaMask wallet. Make sure to select the "Mumbai" network on your Metamask before connecting the wallet. -
Make sure that the State contract is selected in the contract drop-down menu and "Load contract from address" adding 0x46Fd04eEa588a3EA7e9F055dd691C688c4148ab3 as contract address.
-
Check identity state at T=0. To check the identity state call the getState function on the State.sol passing in your identifier. The identifier is the first public input in the public array returned from the solidity calldata from the previous tutorial. The result is zero as there's no identity state associated with that identifier because the identity state has never been published on-chain (yet!)
-
Now update the identity state by calling the
transitState
function on State.sol.The outputs generated from the previous tutorial are passed as inputs to the
transitState
function. See the one-to-one mapping between the outputs from state transition and the inputs to thetransitState
function in the diagram below:transitState Function Inputs -
Check the new state. To check, call the
getState
function again by passing the value of the identifier you used above as an input to thetransitState
function.
You can see that the console displays a new state:
uint256:14531895531750268543323474544059484523319511522635242711319115705040584883009