Coding Guidelines in JS
I. To create a new account in your client/app, you need to follow these steps:
npm install bip39<script src="https://cdn.jsdelivr.net/npm/[email protected]/src/index.min.js">
</script>npm install @fruitsjs/core
npm install @fruitsjs/cryptoimport * as bip39 from 'bip39';
// This is a passphrase according to BIP39 standard.
// Currently we only accept passphrases according to this standard.
const passphraseMnemonic = bip39.generateMnemonic();import {generateMasterKeys} from '@fruitsjs/crypto';
import {Address} from '@fruitsjs/core';
const keys = generateMasterKeys(passphraseMnemonic);
// This key is used to active account
const publicKey = keys.publicKey;
// This key is used to sign transactions.
const privateKey = keys.signPrivateKey;
const address = Address.fromPublicKey(keys.publicKey, 'FRUITS');
// Account Id: 4397003537557138002
const accountId = address.getNumericId();
// Address: FRUITS-PCLL-FH85-CPEZ-5DC3-UECE-DPK7
const addressRS = address.getReedSolomonAddress();II. To activate your account on FRUITS network, you need to follow these steps:
Last updated