Eoslime
Search…
Static Methods
Keep in mind the following points which are applicable for each create-account function:
  1. 1.
    It buys ram for 8192 bytes
  2. 2.
    It executes blockchain create-account transaction
  3. 3.
    It sets the executive authority to active

create (name, privateKey, ?accountCreator)

Creates a fresh new account for a given name and private key
Keep in mind that this name may already exists on the network
Defaults/Optionals:
  • accountCreator - Default Account
1
const eoslime = require('eoslime').init();
2
3
const name = "Account name";
4
const privateKey = "Account private key";
5
6
const account2 = await eoslime.Account.create(name, privateKey);
Copied!

createFromName (name, ?accountCreator)

Creates a fresh new account for a given name
Keep in mind that this name may already exists on the network
Defaults/Optionals:
  • accountCreator - Default Account
1
const eoslime = require('eoslime').init();
2
3
const account2 = await eoslime.Account.createFromName('name');
Copied!

createRandom (?accountCreator)

Creates new random account
Defaults/Optionals:
  • accountCreator - Default Account
1
const eoslime = require('eoslime').init();
2
3
const account2 = await eoslime.Account.createRandom();
Copied!

createRandoms (accountsCount, ?accountCreator)

Creates new random accounts
Defaults/Optionals:
  • accountCreator - Default Account
1
const eoslime = require('eoslime').init();
2
3
const accountsCount = 2;
4
const accounts = await eoslime.Account.createRandoms(accountsCount);
Copied!

createEncrypted (password, ?accountCreator)

Create a new random account and encrypt it. Created account's data is encrypted and a cipherText is derived by encrypting privateKey::dataHash
1
// Account data for encrypting
2
{
3
name: account.name,
4
network: account.provider.network,
5
privateKey: account.privateKey
6
}
Copied!
Defaults/Optionals:
  • accountCreator - Default Account
1
const eoslime = require('eoslime').init();
2
3
const password = 'secret password';
4
let encryptedJSONAccount = await eoslime.Account.createEncrypted(password);
5
6
/*
7
Encrypted JSON account => {
8
"name": "random generated",
9
"network": {
10
"name": 'name',
11
"url": 'url',
12
"chainId": 'chainId'
13
},
14
"ciphertext": "encrypted private key + dataHash"
15
}
16
*/
Copied!

fromEncrypted (encryptedAccount, password)

Decrypt an encrypted account. Decrypts cipherText and gets it's parts (privateKey and dataHash). The PrivateKey is merged with the other encryptedAccount properties into an object which after the merging is hashed. This hash is validated against the dataHash for correctness.
1
const eoslime = require('eoslime').init();
2
3
const password = 'secret password';
4
let encryptedJSONAccount = await eoslime.Account.createEncrypted(password);
5
6
let decryptedAccount = eoslime.Account.fromEncrypted(encryptedJSONAccount, password);
Copied!
Last modified 1yr ago