Skip to content

Instantly share code, notes, and snippets.

@jimmychu0807
Created March 4, 2020 11:58
Show Gist options
  • Save jimmychu0807/0ccb98dd0033f42056fe2ae8f93914e2 to your computer and use it in GitHub Desktop.
Save jimmychu0807/0ccb98dd0033f42056fe2ae8f93914e2 to your computer and use it in GitHub Desktop.
Markdium-用 Polkadot-JS API 輕鬆搭建 Substrate 前端
// 從 mnemonic 來生成,建議方法:
const PHRASE = 'entire material egg meadow latin bargain dutch coral blood melt acoustic thought';
const newPair = keyring.addFromUri(PHRASE);
// 只限開發時使用,即運行 Substrate 節點時加了 `--dev` 參數:
const alice = keyring.addFromUri('//Alice', { name: 'Alice default' });
// 用 32 位的 16 進制數字生成
const hexPair = keyring.addFromUri('0x1234567890123456789012345678901234567890123456789012345678901234');
// 最後你也可用不多於 32位的字符串生成。少於 32位值的前面會加上空格。
const strPair = keyring.addFromUri('Peter');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment