contract_clients
Interacting with smart contracts
Stacks node exposes REST API which clients can use to interact with the blockchain.
The rest of this document assumes that you are running normal Linux OS. Depending on your OS or OS distribution you may need to install additional tools or fine-tune paths.
Bootstrapping a devnet
First, you need both docker and clarinet installed.
Start your local devnet:
Unless you've changed settings in Devnet.toml
, this should give you:
local API node listening at http://localhost:3999
local stacks explorer service running at http://localhost:8000
Creating client to interact with the rNFT contract
For convenience we use NodeJS for client development.
Setup a NodeJS project
Write a client code
This example calls a mint
function of creature-racer-referral-nft
contract.
Create a file i.e. mint.js
:
Running the program
should output something like:
Inspecting the results
If the call was successful it should output the transaction id. You can now observe the transaction status in stacks explorer, i.e.:
http://localhost:8000/txid/YOUR_TX_ID?chain=testnet
The latest version available here
(The content of the page is available for logged-in GitHub users)
Last updated