Git Product home page Git Product logo

substrate-cms's Introduction

(Old) Substrate Developer Hub (ARCHIVED)

THIS SITE IS ARCHIVED.

This repository houses documentation for the Substrate blockchain framework.

The docs are written in markdown, processed by Docusaurus, and hosted at the Substrate Developer Hub.

Contributing

Thank you for your interest in contributing to the Developer Hub and to the larger Substrate community! Please review our contributor guidelines prior to any contribution. If you have any further questions, don't hesitate to reach out on our substrate technical community channel.

Directory Structure

This repository is structured as a Docusaurus project with the markdown files organized in the /docs directory. Images and other assets are in the /docs/assets/ directory. The /website directory is a Yarn Docusaurus project with many helpful scripts (e.g. yarn build, yarn start) for working with this codebase.  In the /website directory you will find sidebars.json and siteConfig.js, which are important Docusaurus files. You will find the source code for some top-level pages in /website/pages/en. Follow our contribution guidelines.

Adding a new document

To add a new markdown document:

  • Create your markdown document in a suitable directory inside /docs.
  • If you have images in your document, put them in the /docs/assets/ directory.
  • Documentation should follow our contribution guidelines.
  • If you want your document to appear in the sidebar, add its reference in the /website/sidebar.json file under the   corresponding section.

Rename an existing document

To rename an existing document:

  • Change the name or path of the document.
  • After the change has been merged, go to the Crowdin project,   make sure the translation is already migrated to the new file automatically for all the target languages.
  • Then go to Crowdin project settings, remove the   old source file in Files tab.
  • If you don't have access to the Crowdin project, please send email to [email protected] with the   file information you want to remove.

Local Testing

  • cd into the /website directory.
  • Execute yarn install and then yarn start.

The Substrate Developer Hub website should open in a browser window.

Link Checker

Once the website is running, you should use the included Yarn script (yarn check-links) to ensure that your changes do not introduce any broken links and to check for any links that have broken since the last time the check was executed. Please ensure all links are fixed before submitting any changes; if you have questions about broken links that you did not introduce, please create an Issue.

Once you are done with your changes, feel free to submit a PR.

Updates

There is a helper script that can be used to update substrate.dev/rustdocs links in the docs/knowledgebase directory.

# This examples demonstrates updating links from v2.0.0-rc3 to v2.0.0-rc4
OLD_VERSION=v2.0.0-rc3 NEW_VERSION=v2.0.0-rc4 ./scripts/update-kb-rustdocs

Production Deployment

Our production site is at substrate.dev. To deploy to production, merge your update into the source branch. This triggers the CI to build the website AND also pull in multilingual translation from our Crowdin project. The final built static site is then pushed to the master branch and hosted on GitHub Pages.

Staging Deployment

We have a staging deployment at devhub-maindocs.herokuapp.com, which is hosted on Heroku. Please check with the devhub team for the username and password to access the staging site.

To deploy to staging, you could push to the staging-source branch in the repository. This will trigger the CI to build the website, pull in multilingual translations from crowdin, and have the final built static site being pushed to staging branch. This in turn triggers Heroku to pick up the latest commit from staging branch and deploy to the staging site.

License

Substrate documentation is licenced under the Apache 2 license.

substrate-cms's People

Contributors

alxheller avatar danforbes avatar imadarai avatar jimmychu0807 avatar joshorndorff avatar maxsupera avatar riusricardo avatar siman avatar yangwao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

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

substrate-cms's Issues

Substrate Storage Deep Dive Workshop/Tutorial

There are a lot of tricks and nuances to using storage in Substrate.

  • Supported storage types (found here)

    • StorageValue
    • StorageMap
    • StorageDoubleMap
    • HashedStorage/UnhashedStorage (This may be just an implementation detail we should briefly talk about, but not go deep into)
    • LinkedMap/EnumerableStorageMap
    • other...?
  • Implications of using different storage types for efficiency

  • Using Vec, implications of letting users input the value for this

  • Storage API: get, put, insert, take, append, etc...

  • Storing Structs (advance things)

  • Storage Upgrades or Migrations, how and when it is possible

  • Charging fees for users storing items

  • Genesis configuration, default value, "add extra genesis"

  • decl_storage macro in general

  • using the Polkadot UI for a number of different storage scenarios

  • more?

@thiolliere may be able to help us here with the details of some of these things if he is so kind :)

Substrate Runtime Module Development vs Ethereum Smart Contract Development

Update 3/25/19:

I think it is reasonable hypothesis that people who are looking to develop on Substrate are familiar with or have worked with Solidity in the past. People who are less technical may be able to evaluate which kinds of apps would be suitable as an Ethereum smart contract (business oriented) and those who are actual contract developers may have developed thought processes or patterns for smart contract development.

I want to have a doc which specifically targets these people who are "comfortable" with Ethereum, and states clearly the differences in thinking and development when building on substrate.

For example:

  • What sorts of projects would be good for Ethereum Smart Contracts vs Substrate Runtime Module, and why?
  • Substrate is inherently a fee-less system, and how that affects your development and functions you can build
  • Storing only critical blockchain specific data on chain, not strings and other random stuff
  • Bricking your chain with bad code
  • Verify first, Write Last vs Revert
  • How to write modular substrate modules versus how you might do the same with solidity
  • etc...

[Add] KodaDot to users with new logo

Hello, as I've noticed original repo is frozen

I wanted to add to https://substrate.dev/en/users.html

  {
    "name": "Starmesh",
    "image": "",
    "homepage": "https://starmesh.xyz/",
    "github": "https://github.com/starmesh/",
    "pinned": false,
    "type": "chain",
  },

No need to hurry, just found there was an expectation to be fully migrated on 26/3.
I can still make PR to old one, but that would add some mess to the migration process.
I can wait, no hurry.

A guide for creating loosely coupled modules

Given a module A which has a dependency on module B, show how you can build module C which can be swapped with B.

Teaches:

  • How to use traits properly
  • Required Functions and Implemented Functions
  • Making a module have no direct dependency on another module
  • Building two modules which satisfy the conditions
  • Some live/practical example of swapping the two

[Meta] Miscellaneous Bits of Substrate Knowledge

We often find bits of Substrate interesting but not sure where it fits into the docs. Keeping this issue open to comment in if you find some tidbits that you think are worth sharing but not sure where. Once we have a list, we might see a logical way of combining them.

Use docker to start a blockchain

This is feedback from one of the community members. The initial requirements are:

Is there a reason that all these tutorials, like this one (https://substrate.dev/docs/en/tutorials/start-a-private-network-with-substrate) are installing and using local rustc versions and not using docker with all this built inside? (or something like that).
I'm working on multiple projects with different versions of rust and there are always some problems with rust nightly versions that are installed and that give errors while running this scripts inside.
Although this is not a problem with project itself but with rustc and the way it works, all this could be bypassed by building docker images that contain all this things inside. The flow would be much simpler especially for new users by using docker.

A few potential solutions for docker usage could be:

  • Add steps for docker usage in the Install Substrate page
  • Add section to start a blockchain with docker in one of the tutorils, like PoE.

Document about choice of hashers

Substrate offers few different hash algorithm, and for double_map, developer have to pick which one to use for first key and second key.

It will be good if there is a documentation on the pros and cons for each algorithm and how to decide which hasher to use.

I think this is all we have so far, which describes when to use blake2_256 but not other hashers.

/// If the first key is untrusted, a cryptographic hasher such as blake2_256 must be used.
/// Otherwise, other values of all storage items can be compromised.
///
/// If the second key is untrusted, a cryptographic hasher such as blake2_256 must be used.
/// Otherwise, other items in storage with the same first key can be compromised.
///
/// Supported hashers (ordered from least to best security):
///
/// * twox_64_concat - TwoX with 64bit + key concatenated.
/// * twox_128 - TwoX with 128bit.
/// * twox_256 - TwoX with with 256bit.
/// * blake2_128 - Blake2 with 128bit.
/// * blake2_256 - Blake2 with 256bit.

https://github.com/paritytech/substrate/blob/8cbfc10a28aafb6aec5487eebca16116f45bbf84/srml/support/procedural/src/lib.rs#L88-L92

Fix code boxes to use the Copy button

A new functionality was implemented in the docs but it requires to have instructions on its own box or use an operator to handle multiples commands.

substrate-node-new substrate-node-template <author-name>
substrate-ui-new substrate

Change to:

substrate-node-new substrate-node-template <author-name>
substrate-ui-new substrate

Or:

substrate-node-new substrate-node-template <author-name> && substrate-ui-new substrate

Restore "Print a message" recipe

In the older runtime recipes that I deleted in 1495d8616b40, There was a section called "Print a message" which showed how to output simple debugging logs. That is not in the new https://substrate.dev/recipes .

I recently saw @shawntabrizi recommend instead to

  1. Compile wasm
  2. Add println!s
  3. Compile native

Is this a better approach?

Original

Sometimes we need to print debug messages while building applications. This recipe shows how to print messages for debugging your Substrate runtime code.

You need to include runtime_io crate from the Substrate core in order to use IO functions from within the runtime modules.

use support::{decl_module, dispatch::Result};
use runtime_io;
pub trait Trait: system::Trait {}
decl_module! {
  pub struct Module<T: Trait> for enum Call where origin: T::Origin {
    pub fn print_something(_origin) -> Result {
      // the following line prints a message on the node's terminal/console
      runtime_io::print(Hello World from Substrate Runtime!);
      Ok(())
    }
  }
}

When this function is executed, the message will appear on the terminal where the Substrate node is running. The following screenshot shows the printed message.
Text "Hello World from Substrate Runtime!"

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.