Skip to content

Commit 347c0ec

Browse files
authored
Update Readme.md
Added a more elaborate readme file.
1 parent 09688ca commit 347c0ec

File tree

1 file changed

+77
-19
lines changed

1 file changed

+77
-19
lines changed

README.md

Lines changed: 77 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,40 +2,98 @@
22
Copyright RiddleandCode
33
--->
44

5-
Install
6-
----------
5+
6+
# ANSI C driver for BigchainDB
7+
8+
This ANSI C driver enables developers to create, sign and send BigchainDB transactions to BigchainDB servers and has been used within several MCU based projects within RIDDLE&CODE.
9+
10+
**Please note**: This driver is written in C but is due to the C/C++ relation compatible with C++ by default.
11+
12+
13+
## Install
14+
15+
16+
Clone the git repository and the submodules
17+
18+
```
19+
$ git clone https://github.com/RiddleAndCode/bigchaindb-c-driver.git
20+
$ git submodule update --init --recursive
21+
```
22+
23+
Having that, the compilation process can be started by running the cmake and make build process.
24+
Please ensure that you have cmake and make installed on your system:
25+
726
```
827
mkdir build
928
cd build/
1029
cmake ..
1130
make
1231
ctest
1332
```
14-
## Note
33+
34+
35+
## Usage
36+
37+
The creation and siging of transaction on BigchainDB is simple. Inputs are taken and transfered to outputs.
38+
The inputs and outputs have to be prepared and defined.
39+
40+
41+
The test code of this project contains all of this aspects and can be used to create simple transactions. The support for more complex transactions is missing at this point in time.
42+
43+
First the transactin is prepared (this is in most cases a very specific task), thereafter
44+
build, signed, fulfilled and serialized.
45+
46+
Now, the transaction can be submitted to the BigchainDB nodes.
47+
48+
```
49+
BIGCHAIN_TX tx;
50+
char json[6000] = {0};
51+
52+
memset(&tx, 0, sizeof(BIGCHAIN_TX));
53+
prepare_tx(&tx);
54+
bigchain_build_json_tx(&tx, json);
55+
56+
char sig[128] = {0};
57+
bigchain_sign_transaction((uint8_t*)json, strlen(json), (uint8_t*)privkey, (uint8_t*)pubkey, (uint8_t*)sig);
58+
bigchain_fulfill_and_serialize(&tx, (uint8_t*)json, 6000, (uint8_t*)sig, (uint8_t*)pubkey);
59+
60+
```
61+
62+
63+
### Note
1564
When building the metadata and asset objects take the following measures:
1665
1. No spaces in the json structure: ```{"key 1": "value a"}``` becomes ```'{"key 2":"value a"}'```
1766
2. Keys should be alphabetically ordered: ```{"key 1":"value a","A key":"A value"}``` becomes ```{"A key":"A value","key 1":"value a"}```
1867
3. No numbers fields, only strings ```{"key 1":2.3123}``` becomes ```{"key 1":"2.3123"}```
1968

2069

21-
BigchainDB Documentation
22-
------------------------------------
23-
* `BigchainDB Server Quickstart`_
24-
* `The Hitchhiker's Guide to BigchainDB`_
25-
* `HTTP API Reference`_
26-
* `All BigchainDB Documentation`_
2770

28-
Usage
29-
----------
30-
test_bigchain_build_json_tx();
3171

72+
## BigchainDB Documentation
73+
74+
* [BigchainDB Server Quickstart](http://docs.bigchaindb.com/projects/server/en/latest/quickstart.html)
75+
* [The Hitchhiker's Guide to BigchainDB](https://www.bigchaindb.com/developers/guide/)
76+
* [HTTP API Reference](http://docs.bigchaindb.com/projects/server/en/latest/http-client-server-api.html)
77+
* [All BigchainDB Documentation](https://docs.bigchaindb.com/en/latest/)
78+
79+
80+
81+
## Compatibility Matrix
82+
83+
The driver should be compatible with BigchainDB version 2.x but got only actively tested with BigchainDB v2.0.0b9. It might work with earlier versions but hasn't been tested with them.
84+
85+
| BigchainDB Server | BigchainDB C driver |
86+
| ----------------- |------------------------------|
87+
| `2.x` | `1.x` |
88+
89+
90+
## Authors
91+
92+
The RIDDLE&CODE team.
93+
94+
95+
## Support
3296

33-
Compatibility Matrix
34-
--------------------
35-
**BigchainDB Server**
36-
``>= 2.0.0b7``
97+
Included code/APIs provided as is. If you find an issue with API, pleaes submit the issue. Help is always availabl at RIDDLE&CODE.
3798

38-
License
39-
--------
40-
* `licenses`_ - open source & open content
4199

0 commit comments

Comments
 (0)