Send data
Once you have your data prepared, you can send it to BLOOCK so it can be certified using our protocol.
When you send a new record to BLOOCK, it's queued internally and assigned to an Anchor. Once this Anchor is processed and transacted into the blockchain, the record gets certified and you will be able to verify it.
The certification of a record may take some time to be confirmed. In order to manage this time interval, see Synchronization.
Here's a code example on how to send a set of Records to BLOOCK:
Javascript
Java
Python
PHP
Golang
const { Bloock, IntegrityClient, RecordClient } = require("@bloock/sdk");
try {
// we set the API key and create a client
Bloock.setApiKey(process.env["API_KEY"]);
const integrityClient = new IntegrityClient();
const recordClient = new RecordClient();
// we create an array of strings which will contain
// the hashes of the records we want to send
let record = await recordClient.fromString("Hello world").build();
let records = [record];
// finally we can send the records
let sendReceipts = await integrityClient.sendRecords(records)
// we get a receipt with informationa about the transaction
console.log(sendReceipts);
} catch (e) {
console.log(e);
}
import com.bloock.sdk.Bloock;
import com.bloock.sdk.client.IntegrityClient;
import com.bloock.sdk.client.RecordClient;
import com.bloock.sdk.entity.Record;
import com.bloock.sdk.entity.RecordReceipt;
class Test {
public static void main(String[] args) {
try {
// we set the API key and create a client
Bloock.apiKey = System.getenv("API_KEY");
RecordClient recordClient = new RecordClient();
IntegrityClient integrityClient = new IntegrityClient();
// we create an ArrayList of strings which will contain
// the hashes of the records we want to send
Record record = recordClient.fromString("Hello world").build();
ArrayList<Record> records = new ArrayList<>(Arrays.asList(record));
// finally we can send the records
List<RecordReceipt> receipts = integrityClient.sendRecords(records);
// we get a receipt with informationa about the transaction
System.out.println(receipts);
} catch (Exception e) {
System.out.println(e);
}
}
}
import os
import bloock
from bloock.client.record import RecordClient
# we set the API key and create a client
bloock.api_key = os.environ["API_KEY"]
record_client = RecordClient()
integrity_client = IntegrityClient()
# we create an array of records which will contain
# the records we want to send
record = record_client.from_string("Hello world").build()
records = [record]
# finally we can send the records
send_receipts = integrity_client.send_records(records)
# we get a receipt with informationa about the transaction
print(list(map(lambda x: x.__dict__, send_receipts))) # pretty print receipts
<?php
require "./vendor/autoload.php";
use Bloock\Bloock;
use Bloock\Client\IntegrityClient;
use Bloock\Client\RecordClient;
Bloock::$apiKey = getenv("API_KEY");
$integrityClient = new IntegrityClient();
$recordClient = new RecordClient();
$record = $recordClient->fromString("Hello world")->build();
$sendReceipts = $integrityClient->sendRecords([$record]);
import (
"log"
"os"
"github.com/bloock/bloock-sdk-go/v2"
"github.com/bloock/bloock-sdk-go/v2/builder"
"github.com/bloock/bloock-sdk-go/v2/client"
"github.com/bloock/bloock-sdk-go/v2/entity"
)
func main() {
// we set the API key and create a client
bloock.ApiKey = os.Getenv("API_KEY")
recordClient := client.NewRecordClient()
integrityClient := client.NewIntegrityClient()
// we create an array of strings which will contain
// the hashes of the records we want to send
record, err := recordClient.FromString("Hello world").Build()
if err != nil {
log.Println(err)
}
records := []entity.Record{record}
// finally we can send the records
receipt, err := integrityClient.SendRecords(records)
if err != nil {
log.Println(err)
}
// we get a receipt with informationa about the transaction
log.Printf("%+v", receipt)
}
Last modified 2mo ago