mirror of
https://github.com/bigchaindb/site.git
synced 2024-11-22 09:46:57 +01:00
copy editing
This commit is contained in:
parent
795ceed2b0
commit
2e3d9ecf79
@ -7,7 +7,7 @@ header: image.jpg
|
||||
---
|
||||
|
||||
- Introduction: How do we structure data?
|
||||
- Explain asset-centric paradigm of bigchainDB
|
||||
- Explain asset-centric paradigm of BigchainDB
|
||||
- High-level components and relationship of components in a transaction => possibly illustrate with a graph, similar to CLI
|
||||
- Illustrate example we are going to use
|
||||
|
||||
|
@ -8,7 +8,7 @@ header: header-car.jpg
|
||||
|
||||
You will learn:
|
||||
|
||||
- How BDB can be used to build telemetry apps to track specific dynamic parameters of an asset
|
||||
- How BigchainDB can be used to build telemetry apps to track specific dynamic parameters of an asset
|
||||
- How to make a `CREATE` transaction to create a car. Assets as representation of real objects.
|
||||
- How asset metadata is updated. In BigchainDB it is possible to use `TRANSFER` transactions to change the state of an asset, in this case the mileage of a car.
|
||||
|
||||
@ -22,7 +22,6 @@ const conn = new BigchainDB.Connection(API_PATH, {
|
||||
})
|
||||
```
|
||||
|
||||
|
||||
# Create a key pair for Alice
|
||||
|
||||
Alice will be the owner of the car, and she will be the only one able to create the asset and update the mileage field.
|
||||
@ -35,9 +34,7 @@ const alice = new BigchainDB.Ed25519Keypair(bip39.mnemonicToSeed('seedPhrase').s
|
||||
|
||||
# Create and post the asset
|
||||
|
||||
An asset in our case will represent an object in the real life. But it can represent a claim, a token, a version document, a finite state machine, etc.
|
||||
|
||||
The asset will live in BigchainDB forever and there is not possibility to delete it.
|
||||
An asset in our case will represent an object in the real life. But it can represent a claim, a token, a version document, a finite state machine, etc. The asset will live in BigchainDB forever and there is no possibility to delete it.
|
||||
|
||||
First we need to define the asset field that represents the car. It has a JSON format
|
||||
|
||||
@ -52,7 +49,7 @@ const vehicle = {
|
||||
}
|
||||
```
|
||||
|
||||
To post a transaction in BDB, firs we need to create it, then sign it and then send it to BDB. There are different methods for each step:
|
||||
To post a transaction in BigchainDB, first we need to create it, then sign it and then send it. There are different methods for each step:
|
||||
|
||||
```js
|
||||
function createCar() {
|
||||
@ -86,7 +83,7 @@ function createCar() {
|
||||
}
|
||||
```
|
||||
|
||||
`carOwner.publicKey` can be considered as the Input for the transaction. When you sign a transaction in BigchainDB you have the rights for the next TRANSFER transactions that could be done with this asset. You always sign with a private key that is derivative from the seed phrase.
|
||||
`carOwner.publicKey` can be considered as the Input for the transaction. When you sign a transaction in BigchainDB you have the rights for the next `TRANSFER` transactions that could be done with this asset. You always sign with a private key that is derivative from the seed phrase.
|
||||
|
||||
With the `pollStatusAndFetchTransaction` we check the status of the transaction every 0.5 seconds.
|
||||
|
||||
@ -167,6 +164,6 @@ function updateMileage(assetId, mileageValue) {
|
||||
}
|
||||
```
|
||||
|
||||
Once we have the last transaction we create the transfer transaction with the new metadata value. Is also needed an ouput which will be the Alice to preserve the ownership of the car and the index of the input being spending which is 0, as there is just one input. Then we sign the transaction and we send it to BigchainDB.
|
||||
Once we have the last transaction we create the transfer transaction with the new metadata value. We also need an output to preserve the ownership of the car and the index of the input being spent. In this case that's Alice and the input being spent is 0, as there is just one input. Then we sign the transaction and we send it to BigchainDB.
|
||||
|
||||
That's it, we have created a car asset, and every time the car travels new kilometers the `updateMileage` should be called with the new value of it.
|
||||
|
Loading…
Reference in New Issue
Block a user