If you’ve reached here, it probably means you already have your Madara node up and running 🚀
Now it’s time that we start playing around with Madara - deploy accounts, contracts and get your app chain up and kicking (and move you on top of the leaderboard as well 😉).
Starkent.js is an npm library that allows you to interact with Starknet using Node.js. We have created some sample scripts for you that allow you to
Declare a contract
Deploy a contract
Transfer funds to an account
Get a transaction receipt
If you’ve ever used Node.js before, using these scripts should be a breeze! The instructions to use the scripts are in the README of the repo. Good luck 👍
Installing starkli
starkli is a CLI tool which allows you to interact with the Starknet based chain using your terminal! Currently, Madara is compatible with starkli v0.1.20. To install this version, go to this link and download the asset which is compatible with your machine (arm
or x86
, mac
, linux
or windows
). Once downloaded, you can extract the file to get your binary. Once you’ve the binary, you can add the binary location to your PATH
and access it on your terminal with starkli
. Alternatively, you can cd
to the location of the binary on your terminal and use ./starkli
. For the tutorial, we will assume you’ve added it to your path.
Ensure you’ve the correct version using
starkli --version
0.1.20 (e4d2307)
Setting up starkli
Once you’ve starkli installed, add your Madara RPC url to the env
. By default, this would be http://localhost:9944
if you’re running it locally. If you’ve hosted your chain for the Clash of Nodes campaign, this would be the rpc_url
you submitted for the listing.
export STARKNET_RPC="http://localhost:9944/"
The next step is to declare the Open Zepplin account contracts on your Madara chain! For this, you can use one of our js scripts above. You need to have Node.js installed.
git clone https://github.com/karnotxyz/madara-get-started
npm i
node scripts/declare.js
./contracts/OpenZeppelinAccountCairoOne.sierra.json
./contracts/OpenZeppelinAccountCairoOne.casm.json
If you see the message, Contract is already declared
it’s fine! It means you’re on the later version of Madara where we added this contract to genesis.
Awesome! You’re now setup to start using starkli
. Follow this amazing tutorial here to interact with your Madara chain.
Some pointers to keep in mind when running the above tutorial.
Madara chains currently support Cairo 2.1.0. The above tutorial is also based on Scarb 0.6.1 which is compatible with this Cairo version. To install this specific Scarb version, you can use asdf as explained here.
When you create your Scarb project according to the tutorial, add the following code inside the Scarb.toml
file
[dependencies]
starknet = ">=2.1.0"
[[target.starknet-contract]]
By now, you might have got the idea that using a Madara chain is similar to using Starknet. You just need to point your RPC url to Madara! So, if you’ve used Starknet before, you are ready to get started. However, if you haven’t, it’s not too late! Here are some good resources to give you a head start on your journey.
Starknet book: https://book.starknet.io/
Starknet docs: https://docs.starknet.io/
Cairo book: https://book.cairo-lang.org/
Starknet Basecamp: https://www.youtube.com/watch?v=8GH92wM4jB0&list=PLMXIoXErTTYX-ZSxlaYDxsR66l5a39IwA
About Madara + Demo: https://www.youtube.com/watch?v=gKGumhRISLU
Starkware has organised an hackathon with a Madara track. The track has over $4000 in cash prizes for projects that build exciting things on top of Madara. And one of the problem statements is building an app chain! So if you believe you’ve something exciting, don’t forget to share it with us here and possible grab a cash prize 💸