Dash CoreDash PlatformDash.orgDash User DocsLog In
Hey! These docs are for version 0.18.0, which is no longer officially supported. Click here for the latest version, 0.25.0!

Retrieve a Data Contract

Retrieve details for a Dash Platform Data Contract


In this tutorial we will retrieve the data contract created in the Register a Data Contract tutorial.



Retrieving a data contract

const Dash = require('dash');

const client = new Dash.Client();

const retrieveContract = async () => {
  const contractId = 'C96rCVpck4RdBQXG3zzP5KH4RKzfKVTsmTauu8FQenJi';
  return client.platform.contracts.get(contractId);

  .then((d) => console.dir(d.toJSON(), { depth: 5 }))
  .catch((e) => console.error('Something went wrong:\n', e))
  .finally(() => client.disconnect());

Example Data Contract

The following example response shows a retrieved contract:



Please refer to the data contract reference page for more comprehensive details related to contracts and documents.

What's Happening

After we initialize the Client, we request a contract. The platform.contracts.get method takes a single argument: a contract ID. After the contract is retrieved, it is displayed on the console.