Skip to main content

Dag4.js Wallets

View Dag4.js on Github

Want more detailed information about accounts are handled on the Hypergraph? Read about Accounts and Keys.

Interacting with Wallets

A wallet consists of a private key, a public key, and an address. You can create a new private key like this.

const pk = dag4.keyStore.generatePrivateKey();

Login with a PK

Before accessing methods on dag4.account specific to a wallet, you'll need to log in with a private key or seed phrase.

dag4.account.loginPrivateKey(pk);

Login with a seed phrase

If you already have a pneumonic phrase generated by a web wallet or somewhere else you can log in with that as well.

dag4.account.loginSeedPhrase('disco foxtrot calm appleseed trinity organ putter waldorf ordinary shatter green portion');

Check DAG address

const address = dag4.account.address;

Get wallet public key

dag4.account.publicKey;