Giter Club home page Giter Club logo

portal's Introduction

DFINITY logo

ICP developer portal

The ICP developer portal brings together all the resources needed for developers to build on the Internet Computer. Primarily, this repo hosts the ICP Developer Docs but also includes the Ecosystem Project Showcase, community tooling page, and the internetcomputer.org 'How it works' series.

The ICP developer portal uses Docusaurus.

Developer documentation

Repo structure

docs
├── concepts
├── developer-docs
│   ├── backend // programming language documentation
│   │   ├── motoko
│   │   ├── rust
│   │   ├── python
│   │   ├── solidity
│   │   ├── typescript
│   ├── daos // NNS & SNS documentation
│   │   ├── nns
│   │   ├── sns
│   ├── defi // token and defi documentation
│   │   ├── asset-custody
│   │   ├── icp-tokens
│   │   ├── icrc-1
│   │   ├── nfts
│   │   ├── rosetta
│   ├── developer-tools // CLI tools, IDEs, CDKs, and agent documentation
│   │   ├── cli-tools
│   │   ├── ide
│   │   ├── off-chain
│   │   ├── on-chain
│   ├── getting-started // introductory onboarding documentation
│   │   ├── cycles
│   │   ├── deploy
│   │   ├── install
│   │   ├── quickstart
│   ├── multi-chain // multi-chain integration documentation
│   │   ├── bitcoin
│   │   ├── ethereum
│   ├── security
│   ├── smart-contracts // canister documentation
│   │   ├── advanced-features
│   │   ├── best-practices
│   │   ├── call
│   │   ├── candid
│   │   ├── deploy
│   │   ├── encryption
│   │   ├── maintain
│   │   ├── overview
│   │   ├── test
│   │   ├── topping-up
│   │   ├── write
│   ├── web-apps // frontend and web app documentation
│   │   ├── application-frontends
│   │   ├── browser-js
│   │   ├── custom-domains
│   │   ├── frameworks
│   │   ├── http-compatible-canisters
│   │   ├── user-login
├── motoko // Motoko documentation - submodule
├── references // reference documentation
├── samples // sample projects - submodule
├── tutorials // tutorial series (developer journey, hackathon prep course, etc). 

Contributing to the Dev Docs

Contributions must:

If proposed documentation additions do not follow the above guidelines, they will need to be revised.

Adding a document

To add a new documentation page, first find the category on the sidebar that you'd like to create a new document under. Then, navigate into that subdirectory in the repo and create a new documentation page. See the repo structure outline for more information.

All documents must be in .mdx format.

Format, language choice, and capitalization

Avoid using the term ‘we’ in documentation. Either eliminate using pronouns or instead, use ‘your’.

  • “Next, we will open the main.mo file.” → “Next, open the main.mo file.”

  • “We need to download dfx before we get started.” → “You need to download dfx before you get started.”

Avoid marketing language and trying to 'sell' the feature. Explain the technology’s benefits in a manner that they should sell themselves to developers.

Follow the Dev Docs Style Guide for guidance on:

  • Page structure.
  • Use of page headings.
  • Use of capitalization.
  • Language, spelling, grammar, and word choice.
  • Use of punctuation.
  • Bulleted lists.
  • Bold text.
  • Italic text.
  • Hints.
  • Links and hyperlinks.
  • Code snippets and code blocks.
  • Command line syntax.
  • FAQ sections.

Best practices

When writing documentation for the Dev Docs, the following guidelines should be followed:

Audience

The intended audience of the Dev Docs are existing ICP devs and Web3 blockchain devs who are interested in developing on ICP after they have experience with Ethereum/Solidity, Solana, Bitcoin, etc.

As a more general guideline, the audience can be thought of as the ‘20-29 crypto community’.

This audience should be kept in mind when writing docs. For example:

  • When introducing new concepts, tools, and ICP features, assume that the developer will need some additional context. You can provide additional context for other related concepts and features by linking to relevant documents or making mention that the feature builds off of concepts mentioned in another article, then link that article.

  • If an ICP-specific term can be related to a broad blockchain concept, use that terminology where it makes sense. For example:

    • Smart contracts on ICP are referred to as canisters.
    • Accounts on ICP are referred to as principals.
    • Multi-chain applications on ICP use Chain Fusion capabilities.
  • When introducing blockchain-specific concepts, it is not necessary to relate concepts to Web2 or traditional programming concepts. It can be assumed that the reader is familiar with blockchain terminology.

Documentation types

The structure and content of the documentation page will vary based on the document type. Some common types are:

Overview

An overview of a documentation section or broad concept of ICP. When creating an Overview page that discusses the capabilities of ICP, the benefits and attributes of the possible capabilities should be written about, not only the currently implemented workflows. For example, instead of writing about the currently implemented Bitcoin and Ethereum integrations, the Chain Fusion overview page discusses ICP’s cross-chain functionalities and benefits on a much broader scale beyond the two current integrations.

For Overview pages, using bullet point lists to describe specific benefits or features of ICP is recommended.

Feature or tool detail page

A page that details a specific tool or feature. Feature or tool pages should provide a deeper explanation of a specific feature or tool, why a developer should use it, and how they can use it. It should describe the currently implemented workflows the feature/tool supports, and should not include details of conceptual ideas that are not currently live for developers to use (future roadmap items, possible improvements in the future, etc.)

Concept

Concept pages describe in more detail a specific concept of ICP. Concept pages should relate to broad Web3 terms whenever possible (smart contracts to canisters, accounts to principals, etc.) Concept pages should remain simple and high-level without providing unnecessary, in-depth details. Readers should be able to quickly understand the technology and its benefits, convincing them to continue learning more and begin developing using the technology.

Tutorial

A tutorial uses a step-by-step format to walk a user through a specific workflow. The Developer Journey is an example of a tutorial series.

Reference

A reference page provides low level detail into a feature or technology. API reference pages are an example that provide in-depth detail about different endpoints and methods. Some examples include:

Content

Link to resources that go into further detail and provide a brief summary of the concepts within the doc. Some places that may include further details may include additional information:

Try to answer the following questions within the document:

  • What is the feature, tool, or concept?
  • How do developers benefit from using it? Why should they care about it?
  • How can developers use it?
  • What dependencies do they need to download or import into their project to use it?
  • Are there any best practices they should follow?
  • What are the limitations? Are there any nuances they should be aware of?
  • What resources or docs should they go to for more information?

Duplication and redundancies

Avoid duplication of content whenever possible. If content exists elsewhere on the Dev Docs that explains the concept or feature you’d like to include, link to that page rather than re-explaining things.

Avoid using several sentences that say the same thing. Remove redundancies whenever possible.

Code snippets

When inserting code snippets into a document, you may use full, deploy-ready snippets, or you can use small pieces of code to demonstrate a specific feature or function.

To determine which form suits the document best, answer the following:

  • Does the document focus on a specific feature or functionality, or does it showcase an entire dapp/service?
  • If the development showcases a specific feature, a partial snippet may be appropriate.
  • Is implementation of this feature/functionality very complex? Does it require prerequisite knowledge?
  • If the feature is fairly simple and doesn’t require much prerequisite knowledge, a small partial snippet can be used.
  • Are the prerequisites for using this code available elsewhere in the documentation? Is it clear that these prerequisites should be followed prior to inserting this feature?

When in doubt, try to use full code snippets. This additional context can help limit confusion and aid in developer onboarding/developer adoption of new features.

Simplicity

Keep content as brief and to-the-point as possible. Do not over-explain concepts. Try to use pointed sentences that do not contain ‘fluff’ words.

Keep in mind that developers want to find the answers to their questions as quickly as possible. Having long-winded explanations that they must decipher can prevent them from staying on the documentation and prevent them from onboarding.

For non-native English speakers, having long paragraphs with redundant sentences can cause confusion and onboarding friction.

Language-agnosity

Avoid giving the impression that developers must learn and use Motoko to create canisters. When possible, provide code snippets in as many languages as possible. Use the Docusaurus tab functionality to format these examples. Reach out to @jessiemongeon1 for questions/assistance with this.

For some documentation instances, this may not be possible, such as Rust crates and Motoko libraries.

Visual aids

When introducing new protocol concepts or architecture, visual aids can be extremely beneficial for the reader. If possible, create a visual aid to help explain these new concepts.

Excalidraw is a recommended tool for creating these visuals.

Resources

At the end of the document, it can be beneficial to developers if you include links to additional resources. If a developer reads through the document and still has questions, where should they go? This may include:

  • Tutorials that showcase this feature.
  • The Github repo for this feature or tool.
  • Additional reading resources, such as a concepts page or a how it works page.

Guidelines

When writing documentation, keep the following best practices in mind:

  1. When linking other documents, avoid the format:

  2. Be brief. Cut out unnecessary words and sentences.

  3. Follow the style guide for formatting and language.

  4. Avoid creating duplicate content. Link to existing content whenever possible.

  5. Provide high-level overviews of technology and concepts. Avoid giving a deep-dive on different technologies.

  6. Utilize visual aids when possible.

  7. Utilize language-agnostic examples and code snippets.

Document tags

Document tags are required for all documentation pages. They can be added beneath the title heading (# Title) of the page.

import { MarkdownChipRow } from "/src/components/Chip/MarkdownChipRow";

# Title

<MarkdownChipRow labels={["Beginner", "Motoko", "Tutorial"]} />

Documentation pages should include two types of keywords:

  • Document skill level:

    • Beginner

    • Intermediate

    • Advanced

  • Document type:

    • Concept

    • Tutorial

    • Getting started

    • Reference (Reference pages do not require a skill level tag)

Additional, optional (but recommended) tags include:

  • Language

    • Motoko / Rust / Python / Typescript / Solidity
  • Multi-chain integration

    • Bitcoin / Ethereum
  • Governance (for NNS/SNS docs)

SEO keywords

SEO keywords are required for all documentation pages. They can be added to the frontmatter of the document (first three lines) using the following format:

---
keywords: [intermediate, browser js, javascript, agent js, agents]
---

Keywords must include the words included as document tags (experience level, document type) at minimum. Additional SEO keywords can be added at the author's discretion.

Tabs

To showcase code snippets in several different languages, the Tabs functionality can be used. The Dev Docs uses a custom tab component that defines a 'Beta' badge that is used to label TypeScript and Python snippets as 'Beta'.

Here is an example of how to use this custom tab component:

import TabItem from "@theme/TabItem";
import { AdornedTabs } from "/src/components/Tabs/AdornedTabs";
import { AdornedTab } from "/src/components/Tabs/AdornedTab";
import { BetaChip } from "/src/components/Chip/BetaChip";

<AdornedTabs groupId="language">
<TabItem value="motoko" label="Motoko" default>

```motoko

Motoko code

```

</TabItem>
<TabItem value="rust" label="Rust">

```rust

Rust code

```

</TabItem>

<AdornedTab value={"typescript"} label="TypeScript" endAdornment={<BetaChip />}>

```typescript

TypeScript code

```

</AdornedTab>

<AdornedTab value={"python"} label="Python" endAdornment={<BetaChip />}>

```python

Python code

```

</AdornedTab>
</AdornedTabs>

Tooltips

Tooltips are pieces of text, usually glossary keywords that display an info box when moused over. Tooltips are optional but recommended for content tagged as 'Beginner'.

To use tooltips, first import the necessary module:

import { GlossaryTooltip } from "/src/components/Tooltip/GlossaryTooltip";

Then, use the tooltip in line with the code:

I'm a <GlossaryTooltip>canister</GlossaryTooltip> deployed on ICP.

The word included within the <GlossaryTooltip> tags must be defined in the file /static/glossary.txt in the format:

word=definition.

Please make sure you put an = equal sign between the term and the definition, and keep each term + definition pair on a single line.

Failing to do so will break the code that auto-populates the Tooltip with the appropriate definition.

Submodules

The developer docs utilize submodules for several subfolders of documentation. To edit these pages, changes must be made in the submodule's repo and merged into that repo. Then you must open a PR in this repo that pulls the latest submodule updates to apply the changes.

The following submoules and their corresponding repos are currently used:

Updating submodules

To update all submodules, run the command:

git submodule update --remote

Reverting submodule changes

To revert submodule changes in a PR that did not intend to update submodules, run the commands:

git checkout master
git submodule update
git checkout <your branch>
git add * # especially submodules

Embedding YouTube videos

You can embed YouTube videos by adding the following iframe code, replacing the src= link with the YouTube link you'd like to embed:

<iframe width="560" height="315" src="https://www.youtube.com/embed/b9_PsPQ24tE?si=0w2pIVuSJFhRWAeX" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>

Contribution workflow

Here is a description of how a contribution should be made to the developer portal:

  1. The contributor creates a fork/branch where proposed changes are made.
  2. A pull request (PR) is created from that branch/fork to master. A build preview is generated and the reviewers can directly check the preview website.
  3. After the pull request is merged into master, CI/CD will deploy the contents to ICP. The changes made will appear on the website.

Deployed previews

Whenever a Pull Request for a branch is created on the repository, a GitHub bot will comment on the PR with a preview link once one has been generated.

You can view the status of the preview build job by navigating to the bottom of the PR and viewing the 'Build deployment preview' job. If this job fails, the preview will not be shown. Any errors in the build must be resolved before the PR can be approved and merged.

Deployment best practices

The portal repo uses git submodules to distribute content authoring across several repositories. This can prove challenging if you want to make updates to docs that refer to stale content in other repos. Here are some best practices that may prove helpful when contributing to portal.

  1. Don't commit changes to submodules. a. Check your staged changes and see if any files are nested within the submodules directory. If so - revert them. Those changes must go into the corresponding submodule repository.
  2. Be wary of the order of operations when it comes to submodules. a. If you do intend to make changes to content under submodules, the changes need to be merged into the respective repo first. b. Once the change has been merged, you will also need to update portal's ref to that repo. You can do that by running git submodule update --remote --merge
  3. Build locally. a. You can save yourself some headaches if you run npm run build locally before you push your changes. If the build fails locally, it will almost certainly fail in CI. b. Our CI requires that a set of checks pass before a PR can be merged. One of those checks is whether the code can be deployed to a canister. You do not need to deploy a canister locally, but at the very least npm run build should pass.

Changing the roadmap

The roadmap items are stored as markdown files inside the roadmap directory.

The items are grouped by domain and status.

roadmap
├── 1_core-protocol
│   ├── deployed
│   │   ├── network_performance.md
│   │   └── nodes_can_be_reassigned.md
│   ├── in-progress
│   │   ├── 1_btc-integration.md
│   │   ├── 2_tecdsa.md
│   │   ├── 3_https-outcalls.md
│   │   ├── 4_high-replication-subnets.md
│   │   └── 5_deterministic-time-slicing.md
│   ├── index.md
│   └── pending
│       └── eth-integration.md
├── 2_boundary_nodes
│   ├── deployed
│   │   └── icos-nodes.md
│   ├── in-progress
│   │   ├── 1_seo_and_streaming.md
│   │   ├── 2_asset_canister_caching.md
...
  • To change the title, links, or ETA of an item, edit the metadata section at the top of each markdown document.
  • To change the status of an item, eg. from in-progress to deployed, move the file to the deployed directory.
  • Items are listed in alphabetical order of their filename, to enforce a certain ordering between items you can prefix the filenames with numbers.
  • To mark an item as a community request, set is_community: true in the item's metadata.

Each domain folder contains an index.md file which adds metadata, like a title, a description, and cover images.

Changing the 'how it works' content

The 'How it works' page cards and subpages are stored as markdown files inside the how-it-works directory.

how-it-works
├── 1_about
│   ├── 01-overview-of-the-internet-computer.card.md
│   ├── 01-overview-of-the-internet-computer.subpage.md
│   ├── canister-lifecycle.card.md
│   ├── canister-lifecycle.subpage.md
│   └── index.md
├── 2_featured
│   ├── direct-integration-with-bitcoin.card.md
│   ├── direct-integration-with-bitcoin.subpage.md
│   ├── index.md
│   ├── sns.card.md
│   ├── threshold-ecdsa-signing.card.md
│   ├── threshold-ecdsa-signing.subpage.md

The directory contains markdown files ending in .card.md and .subpage.md.

The .card.md files will show up as part of the /how-it-works page, under the section they are grouped in (eg. Featured).

The .subpage.md files will each generate a subpage under /how-it-works/, based on the files' metadata and content:

  • The slug parameter will determine the final URL, eg. the slug canister-lifecycle will generate the page /how-it-works/canister-lifecycle.
  • The title, abstract (optional), and coverImage will determine how the page looks when shared on social media

Adding documentation for community-created agents and CDKs

The agents and CDKs sections should not only contain docs for DFINITY-created agents and CDKs. We therefore invite other projects to:

  • Link to their own agents or CDKs on the respective index pages (the files to be edited are in docs/developer-docs/build/agents/index.md or docs/developer-docs/smart-contracts/write/overview.mdx).
  • Add their own documentation as a folder under Agents or CDKs.

Adding community-created developer tools

We invite developers to add their ICP-focused developer tools to the developer tools page by appending an entry to the communityToolingItems array in src/components/Common/toolingItems.ts.

Please make sure to add appropriate tags to make the tool easy to discover for other devs. Avoid introducing new tags if possible.

Community-created sample projects

You can submit your sample project to be displayed on the samples page.

Add your submission to the community projects file and open a pull request. You can use an editor with TypeScript support to make sure your submission follows the schema.

Showcase submission guidelines

Disclaimer: You should have a working canister for your product to be showcased. Our team will review the PR and get back to you for any further questions. In the meantime, please contact [email protected] if you have any questions.

Add your project to the end of showcase.json. Refer to the object schema below for the required fields.

Make up a unique project id. For example, if your project is called Awesome ICP Project!, your project id could be awesome-icp-project.

Your logo/video/screenshots files should be prefixed with your project id, and placed in the /static/img/showcase folder. For example, if your project id is awesome-icp-project, your logo file should be named awesome-icp-project_logo.webp and placed in the /static/img/showcase folder.

The Ecosystem Helper is an on-chain tool that helps you submit your project to internetcomputer.org. It helps with image conversion, resizing, previewing the project cards used throughout the website, and it produces a valid JSON document you can use. Fill out the form and download the asset bundle in a zip file.

Asset guidelines

Asset Requirements Format Notes
logo required 112x112px webp/svg/png Currently displayed 56x56px
screenshots optional 1024x576px webp/jpg The schema supports multiple files, but only the first one will be displayed
video optional max 10MB webm/mp4 If there is a video file specified, it will be displayed instead of a screenshot.

Tags

The list of tags is not final, and will be updated as the project evolves. For now, the following tags are available:

  • Wallet
  • Bitcoin
  • NFT
  • SocialFi
  • DeFi
  • Games
  • DAO
  • Metaverse
  • Tools / Infrastructure

Object schema

  {
    id: string,
    name: string,
    oneLiner: string, // short description of the project
    website: string, // URL starting with `https://`

    tags: ('Wallet' | 'Bitcoin' | 'NFT' | 'SocialFi' | 'DeFi' | 'Games' | 'DAO' | 'Metaverse' | 'Tools / Infrastructure')[],
    description: string, // description of the project
    stats: string, // eg. "10,000 users"
    logo: string, // url to logo file, eg. /img/showcase/awesome-icp-project_logo.webp
    
    usesInternetIdentity: boolean,
    authOrigins?: string[]; // optional additional (URL) origins that can be utilized for signing in to your dapp

    github?: string, // full URL to github repo, if available
    youtube?: string, // full URL to a YouTube video or channel, if available
    twitter?: string, // full URL to a twitter account, if available

    screenshots?: string[], // optional array of urls to screenshot files

    video?: string, // optional url to video file, eg. /img/showcase/awesome-icp-project_video.webm
    videoContentType?: 'video/webm' | 'video/mp4', // to feed into the type attribute of the video/source element

    submittableId?: string, // optional id of the submittable form
  },

Running a local development instance of this repo

Requirements

Install and run locally

While modifying documentation in the repository, you can preview the changes locally by executing the following commands.

cd portal/
git submodule update --init
npm ci
npm start

The developer portal frontend should appear in your browser under http://localhost:3000.

To preview a specific locale in the context of an internationalization contribution, start the docs with the following command:

npm start -- --locale <locale>

portal's People

Contributors

adambratschikaye avatar ais-dfn avatar artkorotkikh-dfinity avatar bjoernek avatar csepreghy avatar dfinity-bjoern avatar dfx-json avatar dietersommer avatar dominicwilliams avatar dprats avatar harpa12 avatar hugolgst avatar jennifertrin avatar jessiemongeon1 avatar laraas avatar letmejustputthishere avatar meodai avatar mpnho avatar mraszyk avatar murielpinho avatar nikolashai avatar olaszakos avatar r-birkner avatar reigj1 avatar robin-kunzler avatar rvanasa avatar sesi200 avatar ulan avatar vusirikala avatar yejidfinity avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

portal's Issues

SDK Docs

The SDK Docs need better documentation added for:

  • Installing a specific version
  • Using a specific version
  • Setting the default version

It seems like I come across these in random forums (DFX_VERSION=X.X.X && ...) but I can never quite remember it. It would be helpful if it were documented on this page.

Can you add a repo link for each of the Motoko-Base references?

I've been using the Motoko Reference guide on a daily basis. I like to understand what's going on under the hood, so I typically flip back and forth between the reference portal and the source code.

Would it be possible to include a link to the source code for each of the base types? That way I can go straight to the source code from the reference guide.

If not I can stick to using bookmarks. Thanks :)

The cycles faucet does not work

I'm developing an app and had a bad experience with the docs referencing the cycles faucet. If it's not working or has potential to be out of cycles that should be made clear in the docs, otherwise it just leaves a really poor first impression.

I followed the steps, linked to twitter, and it said it was out of cycles:

Screen Shot 2022-06-26 at 12 31 04 PM

fix `local-testing.md` instruction

When we need to add whitelist, here we have instruction as followings

# This command assumes that you are using an unencrypted identity and that you are using the identity you want to deploy the SNS with.
$(dfx cache show)/ic-admin --secret-key-pem ~/.config/dfx/identity/$(dfx identity whoami)/identity.pem --nns-url "https://localhost:$(dfx info replica-port)" propose-to-update-sns-deploy-whitelist --added-principals "$(dfx identity get-wallet)" --proposer "$DEVELOPER_NEURON_ID" --proposal-title "Let me SNS!" --summary "I am friendly."

2 problem here:
1.ic-admin --secret-key-pem only support pem format of ed25519, not secp256k1, because latest dfx will generate pem of secp256k1 by default. ic-admin should support it as well.
2. https://localhost should be http://

The People Parties link is not public. Make the repo public or remove this section for now

Use [WebCrypto API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API) to hide key material from JavaScript, by using `extractable=false` in `generateKey` , see [this](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/generateKey). An example for this can be found in the people parties project, see [here](https://github.com/dfinity/people-parties/blob/06208183a2679189d02bc5e64dcbd71c5f5dfbed/frontend/src/services/auth.ts#L111-L120). This makes it impossible to access the private key from JavaScript.

FR: Publish “Release Notes” more prominently

Problem

Currently, SDK Release Notes can be accessed by in 7 clicks which is hard to find:

  1. Smartcontracts.org
  2. Learn
  3. Docs Introduction
  4. Developer docs
  5. Getting started
  6. Introducing SDK
  7. Release notes

image

Nevertheless, SDK release notes might be the best place to learn about product updates.

On the new website beta.smartcontracts.org the release notes can be accessed by 4 steps:

  1. Go to beta.smartcontracts.org
  2. Docs
  3. Good to know
  4. SDK Release Notes

image

In addition, the release notes are not scrollable - the developer needs to click on each version number to access the information.

Solution

I propose the following website and process changes:

  • Move Release Notes to the top level of smartcontracts.org
  • Make Release Notes scrollable
  • Publish release notes on the developer forum to get community feedback
  • Publish links to each release’s notes to other social channels: Discord, Twitter, Telegram, and others

In addition, we can consider creating an “IC developer blog” that publishes other important information for developers. For example, there’s a lot of useful information in https://kyle-peacock.com/blog which could be cross-posted (if Kyle agrees) to the main IC developer blog. Maybe other developers will also be interested in contributing.

dfx documentation not up to date

dfx 0.12.0 features thing like dfx nns install that are not documented at all. i propose that with every major/minor release of dfx, an updated version of the docs has to be provided that is feature complete. users should be able to look at old documentations, similar to the python docs where you can pick the version of the docs you want to look at

Make "Hello world" walkthrough more structured

I find "Hello world" walkthrough navigation a bit intimidating - there's too much information there. Do we have any other ways to structure a step-by-step guide?

CleanShot 2022-04-14 at 17 08 19@2x

The gold standard here would be Stripe which has tutorials where the steps are linked to the code. However, it's probably hard to implement.
CleanShot 2022-04-14 at 17 16 02@2x

Plaid API is probably closer to what we can create in a short term. It's nicely laid out, not intimidating, and easy to follow:
CleanShot 2022-04-14 at 17 21 18@2x

add more content to rust quickstart

it would be nice to add more content to the rust quickstart and make it as detailed as it's motoko sibling.

@peterpeterparker suggested to try and unite both tutorials with different tabs for each language for the code blocks, i think it would be interesting to explore wether that's possible or not.

network deploy refers to wrong cansister

This line of code:
dfx canister --network ic call hello greet '("everyone": text)'
// Error: Failed to determine id for canister 'hello'.

should be:
dfx canister --network ic call hello_backend greet '("everyone": text)'
// ("Hello, everyone!")

I can't Optimize the code within the target?

when I ran ic-cdk-optimizer target/wasm32-unknown-unknown/release/_rust_canister_.wasm -o target/wasm32-unknown-unknown/release/_rust_canister_-opt.wasm I got the following error.

thread 'main' panicked at 'Could not read the file.: Os { code: 2, kind: NotFound, message: "No such file or directory" }', /Users/apple/.cargo/registry/src/github.com-1ecc6299db9ec823/ic-cdk-optimizer-0.3.4/src/main.rs:34:27

The ledger / token tutorial does not mention ICRC-1 and does not contain the interface in the .did

If you currently follow the ledger tutorial you will get a ledger that does not implement ICRC-1 except if you take the effort to follow the link and, get the latest blessed commit, and change the command.

I expect most people would be to lazy initially to click and find the latest blessed replica commit, but even if you did the ledger.did does not contain the ICRC-1 interfaces even though you can call them. This causes the interface to also not show up if you open the canister in CandidUI.

To drive adoption of ICRC-1 it would probably be best to update the .did, the tutorial commit hash, and to link to the ICRC-1 specification in the tutorial.

local canister execution environment processes

You have stopped any local canister execution environment processes running on your computer.

the above sentence appears in any of the rust cdk tutorials. i think a newbie can't make any sense of it. i propose we

a) remove this entirely, as of dfx 0.12.0 we have a global execution environment running, and rerunning just tells us that it's already running
b) rephrase this sentence with instructions to make it more understandable

{company-id} doesn't get replaced and is displayed in documentation. Possible bug?

Rust is a powerful and type sound modern programming language with an active developer community. Because Rust compiles to WebAssembly, it offers a rich development environment for writing dapps to run on the Internet Computer blockchain. To help pave the way for writing dapps in Rust that can be deployed on the Internet Computer blockchain, {company-id} provides some tools to simplify the process.

image

rust toolchain version

The Rust tool chain must be at version 1.46.0, or later.

what does this mean? how do i check the version of my rust toolchain? i assume this is the rustc version, if so we should phrase it as such.

this sentence appears in the rust cdk tutorials, like here.

Several issues when walk through the "Adding and searching simple records (Rust)" tutorial

Hi, I'm very new to the IC and the Rust programming language, I met some difficulties when trying to go through the Building on the IC -> CDKs -> cdk-rs by DFINITY (Rust) -> Adding and searching simple records tutorial.

On the developer doc: Adding and searching simple records
On GitHub: rust-profile.md

I cannot successfully run the code if I strictly follow the steps, here are some problems I detected from my very superficial understanding.

In the Modify the default project section, some descriptions confused me a bit, such as:

Open the template src/rust_profile/lib.rs file in a text editor and delete the existing content.

The next step is to add a Rust program that implements the getSelf, update, get, and search functions.

Copy and paste this code into the profile.rs file.

Save your changes and close the file to continue.

The file path src/rust_profile/lib.rs which I believe should be src/rust_profile_backend/src/lib.rs if someone create the project with dfx new --type=rust rust_profile with the current version of dfx, this issue also occurs in other parts of the tutorial, such as the place talking about Cargo.toml. Besides, I think the file profile.rs was put into the tutorial without enough context and explanation, We can just write the new code into lib.rs or expressly mention about declaring profile module in lib.rs with mod profile;

In the refered sample code (this code), there are several issues that make the code unrunnable.
In the import statements, I believe this part:

use ic_cdk::{
    call::{self, ManualReply},
    // ...
};

should be:

use ic_cdk::{
    api::call::{self, ManualReply},
    // ...
};

I personally cannot use the original one, it always gave me an unresolved import error. And I also wonder why the imported self in this part is completely not used.

The next problem is about the search function, the original code is quite strange and results in a mismatched types compile error.

#[query(manual_reply = true)]
fn search(text: String) -> ManualReply<Option<Profile>> {
    let text = text.to_lowercase();
    PROFILE_STORE.with(|profile_store| {
        for (_, p) in profile_store.borrow().iter() {
            if p.name.to_lowercase().contains(&text) || p.description.to_lowercase().contains(&text)
            {
                return ManualReply::one(Some(p));
            }

            for x in p.keywords.iter() {
                if x.to_lowercase() == text {
                    return ManualReply::one(Some(p));
                }
            }
        }
    });

    ManualReply::one(None::<Profile>)
}

I modified it in this way to solve the problem:, should the code be like this?

#[query(manual_reply = true)]
fn search(text: String) -> ManualReply<Option<Profile>> {
    let text = text.to_lowercase();
    let mut result = ManualReply::one(None::<Profile>);
    PROFILE_STORE.with(|profile_store| {
        for (_, p) in profile_store.borrow().iter() {
            if p.name.to_lowercase().contains(&text) || p.description.to_lowercase().contains(&text)
            {
                result = ManualReply::one(Some(p));
            }

            for x in p.keywords.iter() {
                if x.to_lowercase() == text {
                    result = ManualReply::one(Some(p));
                }
            }
        }
    });
    result
}

In the Call functions on the deployed canister section, I believe all the canister name rust_profile should be rust_profile_backend.

After all, the last obstacle I met was about ManualReply, I deployed and executed the code above with this testing calls:

dfx --identity Miles canister call rust_profile_backend update '(record {name = "Miles"; description = "Great Dane"; keywords = vec {"Boston"; "mantle"; "three-legged"}})'
# successful, return ()

dfx --identity Miles canister call rust_profile_backend search "Miles";
# error here

I got this error:

Error: Failed query call.
Caused by: Failed query call.
  The Replica returned an error: code 5, message: "IC0504: Canister rrkah-fqaaa-aaaaa-aaaaq-cai violated contract: ic0.msg_reply_data_append: the call is already replied"

And the way I solved this issue was not to use ManualReply:

#[query]
fn search(text: String) -> Profile {
    let text = text.to_lowercase();
    let mut result: Profile = Profile { name: "".to_string(), description: "".to_string(), keywords: vec![] };
    PROFILE_STORE.with(|profile_store| {
        for (_, p) in profile_store.borrow().iter() {
            if p.name.to_lowercase().contains(&text) || p.description.to_lowercase().contains(&text)
            {
                result = p.clone();
            }

            for x in p.keywords.iter() {
                if x.to_lowercase() == text {
                    result = p.clone();
                }
            }
        }
    });
    result
}

In sum, all those were major problems I met when try to go through this tutorial, I hope you are so kind as to take a look on them and make this tutorial more novice-friendly. I'm also glad to participate in doc maintenance, but I think I'm still too new and need to learn more, so I decided to first open this issue.

Links to II interface spec and other links in Search broken

Links like this:
https://internetcomputer.org/docs/current/developer-docs/ic-overview/docs/current/references/ii-spec

that show up in search are broken

You can find these links by searching for let's say "maxTimeToLive"

The issue is these links need to be updated to their working counterpart. In this case:
https://internetcomputer.org/docs/current/references/ii-spec/

The issue over here is the "/docs/current/developer-docs/ic-overview" is redundant and shouldn't be present in the hyperlink for the search result

Floating point arithmetic and Decimal

Add note on floating point arithmetic. It should not be used for finance. On division by zero, f64 gives -inf, inf, or NaN.

Use rust_decimal::Decimal instead.

This is regarding
docs/references/security/rust-canister-development-security-best-practices.md

Realistic Computation and Storage Costs

Hello,

I was trying to identify how much my dApp would cost (in terms of ICP/month) based on estimated monthly active users.
I found https://internetcomputer.org/docs/current/developer-docs/deploy/computation-and-storage-costs/ but to me it's not very clear to me how should I translate:

  1. ICP to cycles
  2. blockchain interaction to type of transaction

For example, if I have a very simple canister that:

  1. Read a number (query)
  2. Set the number (update)

What type of transaction costs would be used to burn the cycles?
Some, like "Compute Percent Allocated Per Second", are not clear to me since I don't know how much the compute power of a replica is, so I don't know how much can it be estimated

Having an official calculator, or better, a program that estimates, for a specific canister, how much it requires in ICP per call, would be really helpful to understand the costs required.

Won't authenticate to twitter even my account created past 90 days.

I'm having issues authenticating to twitter even my account is past 90 days. I'm following a tutorial and would like to try deploying my app to IC networks but having trouble because I don't have cycles.

Hoping that they should also add the github authorization cause not all devs have twitter just saying.

repetitive tutorials

rust tutorials (hello world, simple records, counter) are basically the same, only difference is that you copy a different code snippet and hello world explains the project structure. we should either

a) make distinctive tutorials by creating the dapp step by step
b) remove redundant tutorials and just point people to the examples

dead links in Reference Documentation: IC Interface Specification

use `--no-frontend`?

should we use the --no-frontend flag for tutorials that don't involve the asset canister?

styled component is not working

I have styles.js file where I have all the styles. I have imported it in my all react jsx components. but its not working.
and I have some images in assets folder. this is also not working. this is the error I am getting "Module parse failed: Unexpected character '�' (1:5)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file."

Ledger Wasm too big ... again!

Why does this page (https://internetcomputer.org/docs/current/developer-docs/functionality/ledger/ledger-local-setup) yet again point to a ledger canister that is too big and not deployable? This is still a year after launch and yet the public docs do not have a ledger canister that is deployable locally...despite 3 interventions from this forum thread... This is getting embarrassing now.

Please put in an automated check to ensure the size of the ledger is under 2mb before tagging.

https://forum.dfinity.org/t/ledger-wasm-too-big/11274/6

no asset canister documentation

even though hosting secure frontends on the IC is a unique selling point and constantly brought up in keynotes, there is not a single entry in the docs talking about how they work and what exactly they are.

Quickstart hello greet example fails as of dfx 0.11

Ref: (https://internetcomputer.org/docs/current/developer-docs/quickstart/hello10mins)

Quickstart hello greet example fails as of dfx 0.11
Default canister names are now created using _frontend and _backend suffixes (i.e. the smart contract is called hello_backend.

The Quickstart step: Test the dapp locally via the command line instructs users to type:

dfx canister call hello greet everyone

This will fail with the following error: Error: Failed to determine id for canister 'hello'.

The correct instruction as of dfx 0.11 should be:

dfx canister call hello greet_backend everyone

Here is the terminal script confirming the issue and solution:

dfx canister call hello greet everyone
Error: Failed to determine id for canister 'hello'.
Caused by: Failed to determine id for canister 'hello'.
Cannot find canister id. Please issue 'dfx canister create hello'.

dfx canister call hello_backend greet everyone
("Hello, everyone!")

syntaxis error

At the end of the page with basic syntaxis there is type jimport instead of import

Here is the full code:

jimport Debug "mo:base/Debug";

assert 1 > 0; // never traps
Debug.print "bingo!";

remove or edit "Using Rust without SDK"

In general it is confusing that this part comes right at the toplevel of the cdk-rs page. If we keep it, it should be moved into it's own sidebar item instead

keep this section?

in the Using Rust without SDK section, the most important part – modifying the default dapp – is missing.

Can users actually "easily" write Rust canisters and deploy them without using any of the crates/the sdk? If yes, add a code example to this section. If no, I'd remove the section entirely.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.