# README
bigchaindb-go
Unofficial Go BigchainDB driver.
This is an implementation of a BigchainDB client written in golang. It follows the requirements set out in BEP-13.
TO-DO
- Add tests (WIP)
- Implement many-to-many transfer (WIP)
- Add documentation and more detailed example package
- Benchmark tests
Compatibility
This driver is compatible with BigchainDB server v2.0 and above.
Content
Installation
Run go get -u github.com/filinvadim/bigchaindb-go
Example: Create a transaction
kp, _ := apiv1.NewKeyPair()
cli, err := apiv1.NewRESTClientV1(context.Background(), "0.0.0.0:9984", kp)
if err != nil {
log.Fatalln(err)
}
meta := map[string]interface{}{"test": "test"}
amount := 1.0
_, err = cli.CreateTx(apiv1.ModeAsync, amount, meta, nil)
if err != nil {
log.Fatalln("create", err)
}
Example: Transfer
kp2, _ := apiv1.NewKeyPair()
_, err = cli.TransferOneToOne(apiv1.ModeAsync, amount, kp2, previousCommittedTx, meta)
if err != nil {
log.Fatalln("transfer", err)
}
Example: Stream listening
stream := make(chan models.ValidTransactionResponse, 1)
wsCli, err := apiv1.NewWSClient(context.Background(), "0.0.0.0:9985", log.Printf)
if err != nil {
log.Fatalln(err)
}
err = wsCli.SubscribeStream(stream)
if err != nil {
log.Fatalln(err)
}
for m := range stream {
fmt.Printf("message %#v", m)
}
BigchainDB Documentation
- HTTP API Reference
- The Transaction Model
- Inputs and Outputs
- Asset Transfer
- All BigchainDB Documentation
Authors
- Vadim Filin
- ...
License
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.