Quick Start

Writing "Hello World!" to the blockchain in just one call!

Get your API key

Your API requests should be authenticated using your API key (any request that doesn't include an API key will return an error).

Learn how to Get your API Key.

Your First BWS API Request

We're going to use the BWS.Blockchain.Hash solution to save a message to the blockchain.

Write "Hello World!" to Matchain blockchain.

POST https://api.bws.ninja/v1/smart-contracts/call

Let's write "Hello World!" to the Matchain blockchain network without managing network fees or Web3 wallets by calling a regular Web2 API.

Request Body

Name
Type
Description

solution*

string

BWS.Blockchain.Hash

version*

number

1

network*

string

matchain

operation*

string

insert

parameters*

JSON

{ key: "mykey",

value: "Hello World!"

}

Please copy & Paste one of the following code snippets and run it (remember to use your API Key).

curl --location 'https://api.bws.ninja/v1/smart-contracts/call' \
--header 'X-Api-Key: API-KEY' \
--header 'Content-Type: application/json' \
--data '{
    "solution": "BWS.Blockchain.Hash",
    "version": 1,
    "network": "matchain",
    "operation": "insert",
    "parameters": {
        "key": "timestamp: 1736418591440",
        "value": "Hola"
    }
}'

If executed correctly, check forjobId in the response body part. We will use it to verify that the blockchain operation has been completed correctly and to receive the blockchain transaction receipt and Certificate of Trust.

{
    "statusCode": 200,
    "statusMessage": "",
    "info": {
        "jobId": "59d0f46b-0b58-4972-8aca-51d06f69f25e"
    }
}

Check for Status

To check for job completion and results, use the jobId you got from the previous call.

Please note that interacting with blockchain(s) is asynchronous, so it may take some time for the operation to finish and for the blockchain receipt to be received.

Fetch for the blockchain job status and results.

POST https://api.bws.ninja/v1/smart-contracts/fetch

Using the previous call response jobId we fetch the blockchain job started previously.

Request Body

Name
Type
Description

jobId*

String

(use previously returned jobId, as for example 59d0f46b-0b58-4972-8aca-51d06f69f25e)

Copy & Paste one of the following code snippets and run it (remember to use your own API Key).

curl --location 'https://api.bws.ninja/v1/fetch' \
--header 'X-Api-Key: API-KEY' \
--header 'Content-Type: application/json' \
--data '{
    "jobId": "59d0f46b-0b58-4972-8aca-51d06f69f25e"
}'

You should receive a response indicating the completed job and the related blockchain receipt and certificate.

{
    "statusCode": 200,
    "info": {
        "status": {
            "Value": "completed"
        },
        "request": {
            "solution": "BWS.Blockchain.Hash",
            "version": 1,
            "network": "matchain",
            "operation": "insert",
            "parameters": {
                "key": "timestamp: 1736418591440",
                "value": "Hola"
            }
        },
        "hash": "0xd5c51886e57b1b16e59bd866910f2c689728f9e4025a4abc14bf7b07ae21dcc8",
        "txnUrl": "https://matchscan.io/tx/0xd5c51886e57b1b16e59bd866910f2c689728f9e4025a4abc14bf7b07ae21dcc8",
        "certificateOfTrust": "https://s3.amazonaws.com/bws-backoffice-website-infra-prod/tx/matchain/0xd5c51886e57b1b16e59bd866910f2c689728f9e4025a4abc14bf7b07ae21dcc8.pdf",
        "certificateOfTrustJPG": "https://s3.amazonaws.com/bws-backoffice-website-infra-prod/tx/matchain/0xd5c51886e57b1b16e59bd866910f2c689728f9e4025a4abc14bf7b07ae21dcc8.jpg",
        "certificateOfTrustUrl": "https://prod.bws.ninja/tx.html?t=0xd5c51886e57b1b16e59bd866910f2c689728f9e4025a4abc14bf7b07ae21dcc8",
        "type": {
            "value": "blockchain-job"
        },
        "timestampInMillis": 1736418605359,
        "id": "a89bf8bf-392b-4cc3-8ded-7dbe9d43c341"
    }
}

Congratulations! In just one call, you used BWS to save data into the Web3 blockchain ecosystem.

Last updated