Skip to main content

Add Stamp

To add a stamp with the bStamp API, utilize the addStamp method from the SDK.


Sample Code Snippet

Here is a JavaScript code snippet demonstrating the use of the addStamp method:

import { Bstamp, Network } from 'edeXa-sdk';

async function addStamp() {
const bStamp = new Bstamp({
...settings,
authorization: `Bearer ${token}`,
});
const settings = {
network: Network.SANDBOX, // or Network.MAINNET for the mainnet network
};

const dataToStamp = {
hash: 'HASH',
isPrivate: 'true' // or false for public network
}

const version = {
version: API_VERSION.VERSION_1 // or API_VERSION.VERSION_2 for version 2
}

try {
const addedStampResponse = await bstamp.addStamp(dataToStamp, version);
// Handle success
} catch (error) {
// Handle error
}
}


Key Points to Note

  • Asynchronous Function: The addStamp function operates as an asynchronous (async) function, leveraging await to hold execution until the bstamp.addStamp promise completes.
  • Token Replacement: Make sure to replace token used in Authorization with your token, which you will get in response of authentication method

Request Parameters

ParameterRequiredTypeDescription
hashYesStringEnter your hash value
isPrivateYesBooleanMake your stamp public or private
versionYesStringUse a specific available version of bStamp

Response Format

KeyTypeDescription
idStringUnique identifier for the stamp
txIdStringTransaction ID on the blockchain for the stamp
codeStringAdditional identifier or code for the stamp
hashStringHash value of the stamped document or data
filenameStringName of the stamped file