Skip to content

xdtlab/daten.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

daten.js

A JavaScript interface to the Daten Network

Below is a brief explanation of how to create web-based dApps using JavaScript on top of the Daten Network.

Connecting to a Daten node

First you should connect to a Daten node by creating a wallet object. It accepts an initial node address as its first argument.

var wallet = new daten.Wallet("1.2.3.4:32323");

Get node status

You can get the state of a random node in the network like this:

wallet.getStatus(function(state) {
  alert(state.height);
});

Creating transactions

You should create a transaction before sending it, be aware that the transactions created by this function expire when a new block gets validated across the network, send it as soon as possible!

wallet.createTransaction(name, destination, amount, data, function(tx) {
  // Transaction is created!
}, onError);

Send transactions

Send transactions:

wallet.sendTransaction(tx, function(result) {
  // Check if the process was successfull.
}, onError);

Query data

Find data:

wallet.query(params, function(txs) {
});

Listen to transactions

Listen to incoming transactions to a specific address:

wallet.listen(address, function(tx) {
});

Confirming transactions

Confirm transactions:

wallet.confirm(tx, maxConfirmations, function(confirmations, hashTries) {
});

About

A Daten client library written in JavaScript

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors