Here are the list of tips and tricks to develop solidity in a modern way (understand back to 2017 year :-) )

IDE Support

I recommend you to use the excellent Jetbrains Webstorm or Intellij IDEA with the folllowing free plugins:

  • Intellij-Solidity see https://github.com/intellij-solidity/intellij-solidity
  • Solidity Solhint Plugin allow to enable Solhint inspection capabilities in your project. It highlight of warnings / errors found by the linter in editor during code modification.
  • Refactoring in Javascript is excellent but still not supported in Solidity,

Auto-completion of solidity

Your smart contract code also deserve to be recognized by your IDE and in your test-cases. In order to enjoy auto-completion you'll have to use Soltsice ()https://github.com/dbrainio/Soltsice) to convert Solidity code to TypeScript at compile time.

Add to your package.json

"scripts": {

"types": "soltsice build/contracts types",

},
"devDependencies": {

"soltsice": "^0.9.8"

}

After any major changes to your Solidity code, run "npn run types", once done you can enjoy auto-completion in javascript and in solidity!

Auto-completion in Javascript

Chances are high that you are writing a lot of unit tests, integration tests...I hope you do. In order to get hint from the IDE, you'll need under IDEA/WebStorm settings - Javascript - to add the following libraries by clicking [ download ]

mocha, jasmine, chai, chai-as-promised, babel-core, add as much as your are using in your code.

FYI by doing so  you just add typedscript packages from DefinitelyTyped GitHub project.

Auto-completion of Web3 

Web3 is the Ethereum compatible JavaScript API which implements the Generic JSON RPC spec. It's available on npm as a node module, for bower and component as an embeddable js and as a meteor.js package.

There currently no official Web3 type definition included in the DefinitelyTyped project. But there is one package good enough even if in Beta at https://www.npmjs.com/package/web3-typescript-typings

Debugger

Only the Truffle debugger for now http://truffleframework.com/docs/getting_started/debugging 

Running unit test

Using Karma is still a work in progress with TruffleSuite. A karma-trufflesuite runner is missing (https://github.com/karma-runner) but i am developing one!

CI in Travis with Docker, .travis.yml

dist: trusty
sudo: required
group: beta
language: node_js
node_js:
  - "8"
cache:
  directories:
    - node_modules
before_script:
  - truffle version
script:
  - npm run lint
  - npm run test
notifications:
  slack:
    rooms:
      - secure: xxxxxxxxxxxxxxxx
    on_success: change
    on_failure: always
    on_pull_requests: false

Easy testing of EVM Time shifting  with Truffle snapshot/restore

Buggy right now, but may be solved soon see https://github.com/trufflesuite/ganache-cli/issues/390 

This is a work in progress, i will continue trying to improve my day to day Solidity toolbox! If you have more tips, feel free to use the comment section below.

 

comments powered by Disqus

You might like also

No Thumbnail was found
Usually, a percentage of the tokens is sold to ICO participants and a percentage kept for the company’s needs. The token distribution and allocation of the token is usually a chapter in the future company whitepaper. A pie chart displays how and to whom tokens will be allocated. But how much tokens are allocated (amount) and what are they used for? how much token should I spend for advisor? is 15% of all tokens too much for founder? How many …
73 Days ago
No Thumbnail was found
introduction This is my attempt to list all possible blockchain consensus out there, I welcome pull request of the blockchain community! let's make it the main reference for blockchain consensus. Visit also Tokens-Economy.com to keep track of new developments in the distributed ledger technology space. Blockchain Consensus? At the core of the Blockchain disruption is a consensus algorithm: Consensus algorithms enable network participants to agree on the contents of a blockchain in a distributed and trust-less manner. “Consensus decision-making is a group …
84 Days ago
Initial Coin Offering security checklist
Blockchain technology and cryptocurrencies have revolutionized the way companies raise capital but at the same time are bringing their own sets of challenges. To ensure that your startup will go through that (ad)venture in a safe manner, you should always adhere to best security practices, for your company AND your investors.  This mind map will present you in a visual way lots of valuable information like: A compilation of the most dangerous threats to the ICO industry and how to mitigate, …
105 Days ago
Initial Coin Offering in most relevant countries
 This new rendering will allow you to better compare countries The rendering being dynamic you can also pass some parameters like https://ico.tokens-economy.com/statistics/collage.html?width=800&height=800 The default size is width=450&height=450 Filter by year ico end. e.g all ico ended in 2017 https://ico.tokens-economy.com/statistics/collage.html?year=2017  Filter by category and year https://ico.tokens-economy.com/statistics/collage.html?category=Cryptocurrency  And more ICO with no raised amount is also displayed now. ICO webpage has been added Text in bubble scale now properly and are always centered     …
119 Days ago
2751 coins, 47 Consensus and 82 cryptographic algorithms
The innovation speed in Blockchain landscape is just breathtaking and being able to (or to be honest trying to...) follow all these rapid changes is a chance for all software engineers. At the core of the Blockchain disruption are consensus algorithm: Consensus algorithms enable network participants to agree on the contents of a blockchain in a distributed and trust-less manner. And the consensus algorithm plays a crucial role in maintaining the safety and efficiency of blockchain. Using the right algorithm may bring a significant increase to the …
127 Days ago
Initial Coin Offering in Blockchain-Friendly countries
Ever since Vitalik Buterin and Ethereum settled on Switzerland for its Foundation and Initial Coin Offering (ICO), Switzerland has been popular among blockchain-based businesses and is considered the number one in a list of the top 10 European countries for starting a blockchain company (source cointelegraph.com). PwC also found that ICO volume reached new record highs in the first half of 2018 ($13.7 Billion so far), already doubling the volume of the previous year! That inspired me a way to compare at the same time …
135 Days ago
Evaluating Blockchain Projects With Token Economy Canvas
Business Model Canvas is a strategic management and lean startup template for developing new or documenting existing business models. It is a visual chart with elements describing a firm's or product's value proposition, infrastructure, customers, and finances. It assists firms in aligning their activities by illustrating potential trade-offs. Business Model Canvas: nine business model building blocks, Osterwalder, Pigneur & al. 2010 After reading this great article https://medium.com/@pstehlik/evaluating-blockchain-projects-with-token-economy-canvas-908bc1bab6 I felt the need to create an online editor. "Token Economy Canvas consists of …
171 Days ago
ICO friendliness rating index
Do you want to relocate your Blockchain company to an ICO friendly country? the ICO friendliness rating index is a interactive way to go through the list of countries that are hostile or favorable to ICO and Cryptocurrencies. Attention! a disclaimer is required: No Legal Advice or Attorney-Client Relationship: This chart is provided for informational purposes only and is not legal advice. This information is not intended to create, and receipt of it does not constitute, an attorney-client relationship. Recipient should …
171 Days ago
Joomla 3.8.7 and WTLib WinNMP 18.03
As always updating to the latest version of all your developement components is never without any issues, here is what  you need to take into consideration when upgrading Joomla 3.8.7 and WinNMP 18.03 Install WinNMp 18.03 from https://winnmp.wtriple.com/ in any directory, default is C:\WinNMP\ Unpack Joomla 3.8.7 to C:\WinNMP\WWW\dev for example When starting WinNMP, you can click reload, to see the site appearing    Now edit Nginx virtual server    And cut and paste the following config (you can get it from http://winnmp.wtriple.com/nginx.phpJoomla-Nginx-configuration)   …
198 Days ago
The cryptocurrency hack of Bob
Bob did a lot of (obvious) mistakes, but you will still be able to learn a lot by going through this mindmap. The names have been changed to protect the innocent. Hack of Bob   …
227 Days ago