69 likes
路
6.1K reads
8 comments
Installing Solana on M1:
The build tools evolve quickly, on M1 you might run into an issue when using solana-test-validator
or other obscure build issues later.
So, install and build Solana from source following the instructions of the official doc or even the github which is often more up to date.
OK, thank you for your reply. I will follow the links you reference. And later I will write an article to record my learning on Solana~
So I'm surprised by this tutorial. In principle, it works. Thanks to your tutorial I managed to create a site where people can pay ( :') ) to send jokes.
Today I am 24 hours after the realization of your tutorial to try to go further and I realize that I am still not able to fly of my own wings on Solana. So you'll tell me that it's normal and that you have to make tutorials, but what worries me is that I've already made several haha.
So in fact, I said to myself: "Look, it's cool, we can send our message. Oops I was wrong. I would like to delete it". So I challenged myself to add what is necessary to the program to be able to delete it. But blank page. I have no logic of what I should do.
Overall I have the tracks. Since each joke is an account, I have to close that account. And I thought ok, I have the account for this joke, I just have to send it to the program and that's it! (Thought of Web2 with a simple API) but actually not at all. I realize that I don't know how to think about a Smart Contract.
The different macros (and fortunately in this tutorial we don't need PDAs), when to take references (the problem comes from Rust and not from the tutorial, I've been cramming the Rust documentation for 3 days now), the use of context in the main function etc..
Solana gymnastics is not so obvious. And even if we understand that "everything is account" it doesn't unlock the ultimate logic.
The same goes for editing the message. Impossible to build the function.
It's terrible because I've understood a lot of things since I've been training in Solana:
- Everything is account (In a Todo-list for example, the list is an account but each item inside is an account too)
- It is necessary to have a Signer when a private key is needed (generating a paying transaction)
- Roughly, a blockchain is like a DB, and a program is like an API (data processing, CRUD, ...)
- PDAs are accounts without private keys linked to a program. This gives authority to the program.
- Anchor is a framework allowing the development of Smart Contract on Solana, with multiple macros to simplify the writing of Rust
- Web3 allows interaction with a program. The gymnastics is also new but is very close to Web2
And yet, despite all this, I am still unable to think about the logic of a smart contract. If I had to delete this project, I wouldn't be able to start it again (except maybe the use of anchor init :') )
Salut Alexandre!
Sorry for the late reply, I was thinking for several days about how to answer this best. Since I am writing about Solana, this is actually the same question I am asking myself every day. I hope this answer will help you.
The fact that you cannot write anything from scratch is very very normal.
Why is that? You can't really start from scratch, because it is not a blank canvas 馃柤. It's not a python or js script that you open and you start playing with variables, that would be just making rust code. When writing smart contracts in Ethereum or in Solana we are working with the platform we are targeting.
馃摫 Let's think about Android, iOS or MacOS, when you write a program for these platforms you need to understand how the platform works, otherwise you can't really achieve anything than printing logs. That is the same with Ethereum or Solana we are working on top of that platform so we need to understand how to work with it, how to talk with it.
The bullets points you mentioned are 馃幆 to understand how to do the Solana gymnastic. If you understand these it means you are ready to take the next step!
So what is the next step? The next step is to keep learning how to discuss with Solana. It's about learning the platform system calls.
鈿擄笍 The problem is Anchor, the difficulty here (and I am wondering myself if I will keep writing Anchor programs in the future) is that Anchor hides all these APIs. So it all feels very magic, and you have no ingredients to collect!
To start from scratch, you should know the building blocks of Solana. As you do tutorials you are supposed to collect the ingredients that will help you make new dishes (dapps) on your own. But Anchor is too magical and hide all of these ingredients (Solana system calls).
What now? You need to collect these ingredients and go further than Anchor:
- You already know the most important ingredient which is accounts, without this you can't achieve anything.
- You can collect more of these ingredients here: solanacookbook.com
Unfortunately, there is not a ton of references for these ingredients for now, the way I have been doing it is to look at interesting projects: solana.com/ecosystem
Then find their github and understand how:
- A Token Swap works.
- A NFT works.
- etc...
And by understanding how it works, I mean cut all the noise! 80% of the code is just noise, moving accounts around etc... The key is to find the solana system call that do the hard work:
- Create Accounts (you already know this).
- Create a token.
- Transfer a token.
- Mint / Burn.
- Etc..
馃挭 Stay strong and keep building! Excited to see what you will do!
If you want to do more than just storing decentralized data and actually do something that can only be acheived with blockchains, you might want to take a look at my new article: blog.matanwrites.com/solana-staking-program
Solana is Web 2.0
Program Result not found in scope anyone can guide me?
I think, that is related to the new anchor version: try replacing ProgramResult by Result<()>