It’s crazy how quickly you forget things when you don’t use them. For example, I spent months learning blockchain, Solidity, smart contracts and how these all integrate. Well, I have spent the last 5 days working through a prototype to build my own Token. And a lot of the knowledge eventually came back to me… but a lot slower than I would have liked. So, the smart thing to do would be to document the things I just relearned. So maybe I won’t forget it next time.
I used a lot of the material from Dapp University. The problem is that the tutorial I was following is a couple of years old, and ultimately not exactly what I wanted to do, so it was good to remind me of “a” way to do it, but there are better ways. Let me walk down the path of what I learned.
- Install node.js – since my development was all done in windows, everything requires a few extra hoops to jump through. I had to install it globally with an executable, instead of installing it into my conda instance.
- Use Truffle. This package has so many cool options, that without it, I can’t imagine developing in Solidity
- it’s an easy way to compile projects, migrate projects to any network setup in your truffle-config.js file.
- Truffle Boxes can let you start a project with everything you need, then you just need to update the given files and add your own stuff to it. But it can give you starter websites and lots of code. Great for starting out.
- truffle test is another handy command to quickly determine if your contracts work as expected. You can couple these with chai for even more testing options.
- handy commands include:
- truffle compile
- truffle test
- truffle migrate –reset –network rinkeby
- truffle console
- Setting up the truffle-config.js file has a lot of subtle features and a lot of power. Much of this depends on installing the correct packages.
-
- be sure to check your package.json to ensure you have the correct version and packages.
- Set your solidity version here. Depending on what packages you choose, may force you to use a higher version.
- certain things can become obsolete, so pay attention and use your search engine to understand where errors came from. it is often due to a version mismatch or the package being complete replaced. For example, Truffle-hdwallet-provider has become @truffle/hdwallet-provider since I originally did my blockchain projects.
-
- Be sure to install Ganache – and use it liberally while you are testing the contracts.
- Save a particular ganache instance so that you can copy several accounts into meta mask for easy use.
- Writing the smart contracts can be done in 2 ways… both are pretty slick.
- Sublime Text with a bolt-on to help with the syntax.
- remix.ethereum.org – I totally forgot how handy this tool is. It can connect to local files, or you could code the whole thing in their website. Remix is nice because it offers you a compile option with just a push of a button.
- Build your smart contracts and test in tandem. One of the lessons I walked away with from the DappUniversity tutorial is that it really does work well to write the test first, then add the code to the smart contract.
- Get to know Meta Mask really well. I’m quickly learning that Meta Mask is the really the key to everything.
- it can link to any of the many Ethereum networks. You can even configure it to talk to ganache on your local machine. (see point 3-1)
- Linking to a website is a little more cumbersome than I hoped, but still able to be linked relatively quickly, once you know the steps. (I’ll do a blog post on this soon).
- install it ASAP. in my opinion, it’s the initial steps to web 3.0.
- Get some rinkeby ether sooner, rather than later. No matter what you choose to do, you’ll need this. The cool thing is that a single wallet can hold Ether from multiple systems. (or you could up different wallets like I did).
- https://faucet.rinkeby.io/
- you can get ether by simply doing a tweet or facebook post. Then you can get as much as 18.5 Ether (and you can repeat it again after a certain time period if you need more).
- When you are ready to move a test network like rinkeby, Use Infura, not geth or something similar.
- Using Geth can work just fine, but dealing with the massive download (if you aren’t already doing it) takes a lot of time, and in my opinion a lot of extra hassle.
- Setup an infura site, make a project, and using “@truffle/hdwallet-provider“, you can link your project using infura to talk to many different blockchains (mainnet, rinkeby, etc.)
- When you want to interact with your contract in the test network but haven’t build a frontend for everything, use Remix.
- Remix has a very nice interface that allows you to easily interact with your contract (I’ll do a post on this soon).
And this doesn’t even include the front end. LOL. Anyway, I hope some of these pointers can help, and there will be more posts in the future to go into details on these steps.
Thanks for reading,
As always, thanks for reading and don't forget to check out our SAP Service Management Products at my other company JaveLLin Solutions,Mike