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.
The 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,
storage is persistent and lasts over many contract executions. The contract
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
storing information on the contract instance.
What is the test environment?
ink! provides a test environment
(test_env) which is used
to emulate contract execution off-chain. This can be enabled by the crate feature
test-env and is
mainly used for running tests off-chain.
How do I run off-chain tests?
When building a smart contract with ink!, you can define a set of tests that can be run using the off-chain test environment.
For example, in the minimal flipper contract, you can find a small off-chain test at the bottom of the contract.
You should run this test just like you would any other Rust test:
Join the growing community of ink! smart contract developers:
- Ask development questions on StackOverflow with
- 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 SRML Contracts module.
Visit the reference docs for the ink! abi.
Visit the reference docs for the ink! core.