Skip to content

Quick Start

Introduction

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

Prerequisites

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

npm i lorem-ipsum

Get Started

Lorem Ipsum is simply dummy text of the printing and typesetting industry:

  1. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book
  2. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged
  3. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
// Lorem ipsum variable to store text
const loremIpsum = "Lorem ipsum dolor sit amet, consectetur adipiscing elit.";
const count = 52036;

// Function to manipulate Lorem Ipsum text
function manipulateLoremIpsum(text, count) {
  // Split the text into an array of words
  const words = text.split(' ');

  // Reverse the order of words
  const reversedText = words.reverse().join(' ');

  count += 1;
  return reversedText;
}

// Call the function and display the result
const reversedText = manipulateLoremIpsum(loremIpsum, count);
console.log(reversedText);
console.log(`Current count is: `${count});
# Lorem ipsum variable to store text
lorem_ipsum = "Lorem ipsum dolor sit amet, consectetur adipiscing elit."
count = 52036

# Function to manipulate Lorem Ipsum text
def manipulate_lorem_ipsum(text):
    # Split the text into a list of words
    words = text.split(' ')

    # Reverse the order of words
    reversed_text = ' '.join(reversed(words))

    count += 1
    return reversed_text

# Call the function and display the result
reversed_text = manipulate_lorem_ipsum(lorem_ipsum)
print(reversed_text)
print(f"Current count is: {count}")

Note

Lorem Ipsum is simply dummy text of the printing and typesetting industry.

Account Setup

Lorem Ipsum is simply dummy text of the printing and typesetting industry:

  1. Import the required packages

    import Keyring from '@polkadot/keyring';
    import { u8aToHex } from '@polkadot/util';
    import { mnemonicToLegacySeed, hdEthereum } from '@polkadot/util-crypto';
    
  2. Import Ethereum account from mnemonic

    const keyringECDSA = new Keyring({ type: 'ethereum' });
    const mnemonic = 'INSERT_MNEMONIC';
    
  3. Define index of the derivation path and the derivation path

    const index = 0;
    const ethDerPath = "m/44'/60'/0'/0/" + index;
    console.log(`Mnemonic: ${mnemonic}`);
    console.log(`--------------------------\n`);
    
  4. Extract Ethereum address from mnemonic

    const alice = keyringECDSA.addFromUri(`${mnemonic}/${ethDerPath}`);
    console.log(`Ethereum Derivation Path: ${ethDerPath}`);
    console.log(`Derived Ethereum Address from Mnemonic: ${alice.address}`);
    
  5. Extract private key from mnemonic

    const privateKey = u8aToHex(
      hdEthereum(mnemonicToLegacySeed(mnemonic, '', false, 64), ethDerPath)
        .secretKey
    );
    console.log(`Derived Private Key from Mnemonic: ${privateKey}`);
    
account.js
// Import the required packages
import Keyring from '@polkadot/keyring';
import { u8aToHex } from '@polkadot/util';
import { mnemonicToLegacySeed, hdEthereum } from '@polkadot/util-crypto';

// Import Ethereum account from mnemonic
const keyringECDSA = new Keyring({ type: 'ethereum' });
const mnemonic = 'INSERT_MNEMONIC';

// Define index of the derivation path and the derivation path
const index = 0;
const ethDerPath = "m/44'/60'/0'/0/" + index;
console.log(`Mnemonic: ${mnemonic}`);
console.log(`--------------------------\n`);

// Extract Ethereum address from mnemonic
const alice = keyringECDSA.addFromUri(`${mnemonic}/${ethDerPath}`);
console.log(`Ethereum Derivation Path: ${ethDerPath}`);
console.log(`Derived Ethereum Address from Mnemonic: ${alice.address}`);

// Extract private key from mnemonic
const privateKey = u8aToHex(
  hdEthereum(mnemonicToLegacySeed(mnemonic, '', false, 64), ethDerPath)
    .secretKey
);
console.log(`Derived Private Key from Mnemonic: ${privateKey}`);
Last update: June 11, 2024
| Created: June 11, 2024