Import Contracts From the Stacks Explorer to the Hiro Platform

We’ve tightened the connection between the Hiro Platform and the Stacks Explorer. You can now save contracts from the Stacks Explorer Sandbox—one of the most popular places to discover and deploy contracts—directly to the Hiro Platform.

Type
Product update
Topic(s)
Product
Hiro
Published
October 30, 2023
Author(s)
Sr Engineering Manager
Director of Product
Try a new feature in the Stacks Explorer.
Contents

We know one of the most popular places to discover and deploy Clarity smart contracts is within the Sandbox feature of the Stacks Explorer

The Sandbox lets you edit existing contracts, call functions, access the testnet faucet, and deploy contracts, all conveniently from within the Explorer interface, where you can also check details related to block confirmations, transaction history, and wallet balances.

But previously, there was no easy way to save contracts without copy-pasting code into your local environment. This is tedious to do each time you want to edit and deploy a contract. And further, if you want to deploy more than 1 contract, there may be dependencies between those contracts that make copy+paste deployments significantly more complex, error-prone and time consuming for you. We wanted to fix that.

Besides, if you have >1 contract to deploy and if there was a dependency chain and deployment order mattered, the copy+paste and all the manual verification of the orderings make it significantly more complex, error-prone, and time-consuming for developers.

Now you can save contracts to the cloud via the Hiro Platform, and once in the platform, you can take your contract to the next level by editing the code in the browser or your local editor, leveraging deployment plans (which automates deployment ordering and handling contract dependencies), integrating with chainhooks, and taking advantage of all the features the platform has to offer.

This latest feature adds to the Sandbox’s suite of capabilities, which include:

Write and Deploy Smart Contracts

The sandbox offers a simple user interface to edit and deploy contracts. In this code editor, you can copy/paste code from another source, use sample contracts, change contract parameters, and ultimately deploy the contract to either testnet or mainnet.

With this latest release, you can now also connect to the Hiro Platform via the sandbox and save your contracts to the cloud.

Call Contract Functions

This feature lets you call any function within a Clarity contract. You can choose from the most popular contracts on Stacks or search for your own.

Transfer STX

The sandbox also makes it easy to send STX from the wallet that you connected to the Explorer with to any other STX-compatible address.

Use the Testnet Faucet

The last core feature of the sandbox is a testnet faucet that lets you request testnet STX tokens, so that you can deploy your contract to testnet and debug your code in a public environment. 

To use the testnet faucet, you must be on the testnet network, and you can toggle between the various Stacks’ networks via the Explorer’s nav bar. Learn more about the daily limits of the testnet faucet here and check out this short video on how to get STX testnet tokens:

Search Previous Contracts

You can also search for any contracts you’ve previously interacted with in the sandbox by selecting the wallet detail side panel. Just click the hamburger menu on the right side of the sandbox to open the list of contracts.

Once you select a contract, you can redeploy it, load it in the contract editor, or copy the contract in order to interact with different function calls. 

And with this new ability to import contracts from the Stacks Explorer to the Hiro Platform, you can now conveniently move contracts to your project and build off them. Once you’re on the platform, you can extend or iterate on the contract and connect your local development environment to push code changes directly to Github to better collaborate with friends and share your projects with the world.

Happy coding!

Product updates & dev resources straight to your inbox
Your Email is in an invalid format
Checkbox is required.
Thanks for
subscribing.
Oops! Something went wrong while submitting the form.
Copy link
Mailbox
Hiro news & product updates straight to your inbox
Only relevant communications. We promise we won’t spam.

Related stories