Just follow these instructions.
Next at each launch of your terminal don't forget to use this specific venv:
python3.9 -m venv ~/cairo_venv && source ~/cairo_venv/bin/activate
then, define the starknet network to goerli testnet:
export STARKNET_NETWORK=alpha-goerli
then, define the deployed starknet wallet contract that we are gonna use (and potentially instantiate)
export STARKNET_WALLET=starkware.starknet.wallets.open_zeppelin.OpenZeppelinAccount
(They shared this doc after the basecamp: https://docs.google.com/document/d/e/2PACX-1vQO7MSt_JINcGItO4-aIH-FQE9xN_Ssa6zQXC93f0e7W5g7ECny57w3E2M9-fdTdU5Ne1R-Kt9g8_EB/pub)
- Install rust:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
- Get cairo-lang (python cli) for creating account, declaring, deploying and invoking contracts (python tool seems to only support 0.x cairo):
pip3 install cairo-lang
- Compile Cairo compiler from source (rust lib which is able to compile cairo 1.x)
Now add the binaries to your path:
git clone https://github.com/starkware-libs/cairo cd cairo git checkout tags/v1.0.0-alpha.6 cargo build --all --release
And test it:echo 'export PATH="$HOME/.cairo/target/release:$PATH"' >> ~/.zshrc
It should returns something like that:starknet-compile --version
Now if you want to compile a cairo contract:cairo-lang-starknet 1.0.0-alpha.6
If you want the vscode extension, install nodejs and then go to the correct directory to compile it:starknet-compile file.cairo file.json
then install dependencies:cd $HOME/.cairo/vscode-cairo
compile the package:npm i
Then go to vscode and go the settings of your new extension (Cairo 1.0) and put the right PATH for the compiler, here is mine:vsce package
/Users/blabla/.cairo/target/release/cairo-language-server
You can get some doc here too. First, generate a wallet in local:
starknet new_account --account wallet_name
You should have a return like this:
Account address: 0x0511b37d642d29322f60d18b694391531a7ba5a462952c6f671944bd835cdcc4
Public key: 0x0361edee52ab6f30afa7dfff689a26805af421bc546740285317961672af8a88
Move the appropriate amount of funds to the account, and then deploy the account
by invoking the 'starknet deploy_account' command.
NOTE: This is a modified version of the OpenZeppelin account contract. The signature is computed
differently.
-
Keep in mind that your wallet is actually a contract that is already deployed, but not populated with your datas.
-
In order to do so, let's pre-fund the address of the instancied version of the futur wallet contract address. You need to pre-fund the wallet by sending
0.1 eth
to theAccount address
. -
In order to do so, get some goerli en Ethereum Goerli testnet and bridge it to Starknet with the help of a web wallet like Argent that will help you to generate a seed and use it (so currently we haven't funded our futur wallet that we just generated thanks to commandline).
-
Once you have
0.1 eth
into your web wallet you can now simply initiate the tx to transfer thisether
to theAccount address
(and not to the public key). -
Monitor the tx, once it is
pending
, you can initiate the deployment of your wallet instance:starknet deploy_account --account wallet_name
the return should be:
Sending the transaction with max_fee: 0.000768 ETH (767716294629699 WEI). Sent deploy account contract transaction. Contract address: 0x0511b37d642d29322f60d18b694391531a7ba5a462952c6f671944bd835cdcc4 Transaction hash: 0x609b9a66b79c6720282b48ed21c7bf708237ea638f8ff9056beb9b4f8f327be
And your wallet should be created successfully.
There’s no way for sequencers to verify correctness of ABI submitted on deployment. Which means that you can fake it on the deployment and have a fake ABI verified on Starknet explorer.
It’s actually pretty intuitive that you cannot possibly verify the correctness of ABI without access to contract source code. Thus the sequencer cannot possibly verify it.
nile is a cli framework to simplify starknet dev, but it seems outdates and doesn't work anymore with cairo 1.0 https://github.com/OpenZeppelin/nile
-
Starknet session 1 (fundamental) :
https://www.youtube.com/watch?v=NdP2jTQ34hYWhat we learn here is:
-
that cairo permits you to generate a crypographic proof that can proove the execution validity of your code.
-
Starknet uses Cairo programs and it's not about privacy but scalability
-
Starknet uses STARKs which are quantum resistants (SNARKs aren't), have a proof size which is about
400kb
(SNARKS have a 288 bytes so they are better on that) and have verification complexity of log^2(n) instead of a constant one for SNARKs -
It made sense to me because Ethereum will be quantum resistant in the future
-
Architecture:
- Sequencer: Validates, executes and bundle txs into blocks (so you send your bytecode in Sierra (Sierra = Safe intermediate representation) which allow reverted tx to the sequencer that will compile it to CASM cairo assembly)
- Prover: Creates STARK proofs for Starknet and StarkEx (SHARP)
- Verifier: Ll smart contract that verifies STARK proofs from SHARP
- Starknet Core: L1 smart contract that store changes to L2 global state (DA)
- Full Node: Provide data to L2 dapps
-
Code:
- You declare the attributes into a struct named "
Storage
" - You can read value frolm this storage with the function with
attribute
::read()
- You can write on the storage with *
attribute
::write(
new value
)
- You declare the attributes into a struct named "
-
Tools:
- Protostar is a dev toolchain (I will test it further later)
- scarb (super updated): install it with these instructions (https://docs.swmansion.com/scarb/download) from this repo https://github.com/software-mansion/scarb/releases and don't forget to add the bin folder to the path by adding this to your terminal profile
export PATH="$HOME/.scarb/bin:$PATH"
-