Skip to content

Latest commit

 

History

History
100 lines (71 loc) · 2.07 KB

wallet.md

File metadata and controls

100 lines (71 loc) · 2.07 KB

Wallet

Introduction

Wallet can be thought of as a group of user accounts. Each wallet has its own seed. A private key that represents an account can be generated by hashing the seed and a nonce.

Usage with JavaScript SDK

In JavaScript SDK we have a Wallet class that represents a wallet on the VSYS blockchain.

Properties

Seed

The seed of the wallet.

// wal: Wallet

console.log(wal.seed);

Example output

Seed {
  data: 'chair library xxxx xxxx master pause west ladder valley survey behave attend culture clip blush'
}

Actions

Register a new Wallet

Register a new wallet(i.e. generate a new seed)

wal = Wallet.register();
console.log(wal);

Example output

Wallet {
  seed: Seed {
    data: 'glove safe safe collect switch winter jacket skill slender banner gift industry time skin suit'
  }
}

Instantiate from an Existing Seed

Instantiate Wallet from an existing seed.

const host = 'http://veldidina.vos.systems:9928';
const api = NodeAPI.new(host);
const ch = new Chain(api, ChainID.TEST_NET);
const seed = new md.Seed(
  'chair library crew inject master pause west ladder valley survey behave attend culture clip blush'
);
const wal = new Wallet(seed);
const acnt0 = wal.getAcnt(ch, 0);
console.log(acnt0.addr.data);

Example output

AU7Bekp3fBj25vPR6w1PK7cDC8kDJoLTiCQ

Get Account Object for a Certain Nonce

Get the Account object for a certain nonce.

// ch: Chain

const wal = Wallet.register();
const acnt0 = wal.getAcnt(ch, 0);
console.log(acnt0.addr);

Example output

Addr { data: 'AU7Bekp3fBj25vPR6w1PK7cDC8kDJoLTiCQ' }