ink! is still under development, so the documentation for using it is sparse. However, on this page you will find the best resources to get you started building ink! contracts right away.
Ink! project maintains an up-to-date tutorial teaching all the basics of developing on ink!.
This is the best way to get start learning the language today.
You will learn how to:
- Set up your computer to build and deploy ink! smart contracts.
- Learn the basics of ink! by creating an incrementer contract.
- Learn more advance tricks by developing an ERC20 contract.
ink! provides a set of example smart contracts that can help you understand how it is similar and different to other smart contract languages.
Here are some answers to frequently asked questions developers have while building on ink!.
What is the difference between memory and storage?
memory refers to computer memory, while
storage refers to the on-chain storage used by a contract instance.
memory is temporary and only lasts until the contract execution is done, while
storage is persistent and lasts over many contract executions. The contract
storage is built on top of the runtime storage, and access is considered to be slow.
storage::Vec<T> stores all of its elements in different cells in the contract storage, a
storage::Value<memory::Vec<T>> would store all elements (and a length info) in a single cell. Smart contract developers can use this to optimize for certain use cases. For example, using a
storage::Value<memory::Vec<T>> would probably be more efficient for storing a small amount of elements in the
memory::Vec<T>. In general, we recommend using the more general
storage::Vec for storing information on the contract instance.
How do I run tests?
When building a smart contract with ink!, you can define a set of tests.
For example, in the minimal flipper contract, you can find a small test at the bottom of the contract.
You should run this test just like you would any other Rust test:
cargo +nightly test
Join the growing community of ink! smart contract developers:
- Ask development questions on StackOverflow with the
- Join the live chat in the Smart Contracts & Parity ink! on Riot.
- Report bugs, make feature requests, and ask technical questions on the ink! GitHub.
- Learn more about the design philosophy of ink! in our conceptual documentation.
- Learn more about the Contracts pallet.
- Visit the ink! repository for additional docs and to look at the source.
- Visit the reference docs for the ink! abi.
- Visit the reference docs for the ink! core.