Basic Tutorial - Node
Github Repository
https://github.com/TAAL-GmbH/1sat-tutorial
mkdir 1sat-tutorial
cd 1sat-tutorial
Demo code using our 1Sat Token Studio API can be found on Github so you can clone our repository or if you want to do it manually, we need to make now a node project
npm init
and answer in the questions.
Let’s add the dependencies
npm install bsv@1.5.4
npm install axios
Make sure your package.json looks like this (you might need to change the type to “module” and add a new entry to run the tutorial- "tutorial": "node index.js"
{ "name": "1sat-tutorial",
"version": "1.0.0",
"description": "1sat-tutorial",
"type": "module",
"main": "index.js",
"scripts": { "test": "echo \"Error: no test specified\" && exit 1",
"tutorial": "node index.js"
},
"author": "TAAL",
"license": "ISC",
"dependencies": {
"dependencies": { "axios": "^1.7.2",
"bsv": "^1.5.4"
}
}
Now we are ready to start coding. Create the main file you specified during the setup e.g. index.js
in the root of the 1sat-tutorial
folder as well as the helping file 1sat_utils.cjs using your editor or IDE of choice.
Copy the code from our files and paste.
in index.js you will need to replace the sample API key from your TAAL API Key
You can also tune which steps to run, only the creation of a single/standalone token, the inscription of a collection with one item or individual steps you may want to debug in depth e.g.
const STEPS_TO_TEST =[ 'single', 'collection']; ///const STEPS_TO_TEST =['1.1','1.2','1.3','1.4','1.5', '1.6', '1.7']; //const STEPS_TO_TEST =['2.1','2.2','2.3','2.4','2.5', '2.6', '2.7', '2.8', '2.9'];
You can test now. If all was properly configured you should see something like this:
Add label
Last updated