--- layout: guide title: "Tutorial: How to create a digital record of a piece of art" tagline: Build a digital certificate of a famous painting that you own header: header-art.jpg order: 2 learn: > - How assets can be used on BigchainDB to represent real objects - How to make a `CREATE` transaction to digitally register an asset on BigchainDB - How to create `TRANSFER` transactions to change the ownership of an asset in BigchainDB - How BigchainDB can be used to record dynamic parameters of an asset --- Hi there! Welcome to our first tutorial! For this tutorial, we assume that you are familiar with the BigchainDB primitives (assets, inputs, outputs, transactions etc.). If you are not, familiarize yourself with [Key concepts of BigchainDB](../key-concepts-of-bigchaindb/). # About digital representations of assets We are moving towards an era where every physical object has a digital representation in a database. This can be in the form of a certificate, a simple entry in a database or another form of digital footprint. In the past, this used to be the paper trail associated with the purchase of a car, a painting or any other type of asset. Today, digital is slowly replacing analog in most aspects of our life. Thanks to advances in cryptography, we are reaching a point where even ownership claims of a specific object don't need to be a signed paper certificate anymore. This allows digitization to move to a new level. BigchainDB as a solution is suited perfectly to act as a digital asset registration and tracking tool. Using the example of the digital registration of a famous painting you own, in this tutorial you will learn how to register an asset on BigchainDB and how to digitally transfer the ownership of this asset to someone else. The example is for illustrative purposes. For a real life application, there would be additional components that would need to be included. Let's get started! {% include_relative _setup.md %} # Creation of a key pair Before starting, you need to create a user in BigchainDB. In BigchainDB, users are represented as a private and public key pair. In our case, a key pair for Alice will be created. Alice will be the owner of the painting, and she will be the only one able to make changes to the digital representation of the painting. Using her public key, anyone can also verify that Alice is the owner of the painting. You can generate a key pair from a seed phrase using the BIP39 library, so you will just need to remember this particular seed phrase. The code below illustrates that. ```js const alice = new BigchainDB.Ed25519Keypair(bip39.mnemonicToSeed('seedPhrase').slice(0,32)) ``` # Digital registration of an asset on BigchainDB Now, let's assume that Alice is extremely lucky and gets to acquire the famous painting "Las Meninas" by the Spanish painter Diego Velázquez at a fantastic price during an auction held by the Spanish museum "museo nacional del prado". Now, she wants to ensure that she can digitally certify that she is the owner of this painting. For this reason, she wants to register the painting as an asset on BigchainDB to have an immutable claim. This corresponds to a CREATE transaction in BigchainDB. Using her key pair, Alice can create an asset on BigchainDB. In your case, the asset will represent an object in real life, namely the painting "Las Meninas". This asset will live in BigchainDB forever and there is no possibility to delete it. The first step required is the definition of the asset field that represents the painting. This field contains the data about the asset that is immutable. It has a JSON format: ```js const painting = { name: 'Meninas', author: 'Diego Rodríguez de Silva y Velázquez' place: 'Madrid', year: '1656' } ``` As a next step, you need to generate a `CREATE` transaction to link the defined asset to the user Alice. There are three steps to post this transaction in BigchainDB. First you create it, then sign it and then send it. There are different methods for each step. Here, we are illustrating one of them: ```js function createPaint() { // Construct a transaction payload const txCreatePaint = BigchainDB.Transaction.makeCreateTransaction( // Asset field { painting, }, // Metadata field, contains information about the transaction itself // (can be `null` if not needed) { datetime: new Date().toString(), location: 'Madrid', value: { value_eur: '25000000€', value_btc: '2200', } }, // Output. For this case we create a simple Ed25519 condition [BigchainDB.Transaction.makeOutput( BigchainDB.Transaction.makeEd25519Condition(alice.publicKey))], // Issuers alice.publicKey ) // The owner of the painting signs the transaction const txSigned = BigchainDB.Transaction.signTransaction(txCreatePaint, alice.privateKey) // Send the transaction off to BigchainDB conn.postTransactionCommit(txSigned) .then(res => { document.body.innerHTML += '