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.
In JavaScript SDK we have a Wallet
class that represents a wallet on the VSYS blockchain.
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'
}
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 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 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' }