API - Smart Contracts

This guide covers the key elements of using the API to generate Smart Contracts
Note - this guide is currently under construction
Note - the methods outlined below are currently unreleased and are ONLY available on the TESTNET. Having said this, it makes now a great time to get familiar with them and prepare for when they launch.

No way!

Yes, way ;)
You can use our API to create Smart Contracts on the Cardano Blockchain.

What can I do?

At the moment, we have listed Method Calls based around what we need to build our upcoming NMKR Marketplace, we currently offer the ability to:
  • Offer a direct NFT sale
  • Offer an NFT auction
  • Check details of the active Smart Contracts

What about Plutus?

You may have heard that Smart Contracts on Cardano are written in a language called 'Plutus' which is a functional programming language derived from 'Haskell'. Like Haskell, it is extremely secure and deterministic but also generally considered to be difficult to learn.
At NMKR Studio, our mission is to make this incredible technology accessible, so in the same way we did with the minting process on our original API, we are doing the same with Smart Contracts.
With the API, you essentially have an indirect ability to invoke pre-written Smart Contracts. The NMKR Studio servers already have the Plutus code written and when you make the API method calls, you will be triggering the NMKR Studio Cardano Nodes to deploy the related Smart Contracts to the Cardano Blockchain with the parameters you specify.

Who is this for?

The NMKR Studio API is designed to be used by skilled developers who are looking to create a custom implementation. For most projects, our Payment Gateway will provide the functionality you need and interestingly actually uses the API for the underlying functionality.
This is still in the very early stages of development and even though you will not need to write ANY Plutus code, is still a complex activity.

Smart Contracts

Smart Contracts can be thought of as 'the decentralised invocation of code relating to financial activities'. This definition is reasonably accurate and explains why they are important without the need to get into the inherent complexity (of which there is no shortage of in this domain).

Whats the difference?

Without Smart Contracts, you can only have Centralised Applications like we are used to working with on the internet over the last ~20 years.
As an example, when you make a purchase on a Centralised Marketplace, you are sending the information to that companies servers, which process the information using logic that the company has defined and implements the results. The company is essentially a 'middle-man' who needs to be trusted to be both honest and competent.
Smart contracts allow you to deploy this logic onto the Cardano Blockchain, which means it is decentralised. Think of this as a set of instructions, 'waiting' (sort of under its own autonomy) to be triggered into action. Once triggered, the decentralised Cardano Nodes will provide the computing power to run the logic and implement the results.

Overall Flow

With the current Smart Contracts we offer through the API, the flow always follows these steps:
The methods available currently relate to those needed for our Marketplace, such as the need for users to be able to set up a Direct Sale (Buying/Selling an NFT for a set price) as well as the BetOnAuction (Usual Auction Bidding Process).
All of these flows start with the first API call CreatePaymentTransaction, which creates the initial transaction (it has an accurate name).
  1. 1.
    Create the Payment Transaction
    1. 1.
      Set the Parameters like the type (Direct/Auction), prices and NFT
    2. 2.
      Setup any notifications
    3. 3.
      This essentially initialises the process
  2. 2.
    Lock the NFT
    1. 1.
      The purpose of this is to prepare for the user to sign the transaction
    2. 2.
      Receive key parameters like the CBOR
    3. 3.
      At this point, the NFT remains in the owners wallet
  3. 3.
    Sign the transaction (not actually an API call)
    1. 1.
      With the transaction ready, it needs to be signed by the wallet that owns the NFT they are planned to sell
    2. 2.
      Otherwise, we couldn't sell it!
    3. 3.
      Doing so provides the SignedCBOR, which is needed for the next step.
  4. 4.
    Submit the transaction
    1. 1.
      The purpose of this is to use the SignedCBOR parameters to submit the transaction to the blockchain
    2. 2.
      Submitting the transaction = submitting the Smart Contract to the blockchain
    3. 3.
      Once submitted, the NFT is then 'placed inside' the Smart Contract, ready to be purchased or bid on
The key to getting this right, is to make sure everything is done in the correct order. It also should be considered a necessity to first attempt to implement this using the Testnet.

Full tutorials

The links below will show full tutorials for all of our active Smart Contract Flows. We are calling these flows as they have to make use of several, consecutive API method calls to create the end goal.

Direct Sales