Skip to content

Commit

Permalink
document receipts + verify method
Browse files Browse the repository at this point in the history
  • Loading branch information
Zach Alam committed Dec 10, 2020
1 parent c8735b8 commit 72c66ef
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 13 deletions.
3 changes: 2 additions & 1 deletion docs/_sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
* [Installation](/guide/install.md)
* [Setup](/guide/setup.md)
* [Methods](/guide/methods.md)
* [Helpers](/guide/helpers.md)
* [Receipts](/guide/receipts.md)
* [Troubleshooting](/guide/troubleshooting.md)
* Resources
* [Providers](/guide/providers.md)
* [Private Keys](/guide/privateKeys.md)
Expand Down
11 changes: 0 additions & 11 deletions docs/guide/helpers.md

This file was deleted.

11 changes: 11 additions & 0 deletions docs/guide/methods.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
## getByTx()
Get the details of a stamp by means of a Ethereum transaction id (txid).

**Parameters:**
1. `string` - txid, Ethereum transaction id.
**Returns:** `object` - receipt object.

```javascript
const txid = "0xa9fab29a809d3d59660ea9a34353f2574c6ac49ee65af";
const receipt = await bitfact.getByTx(txid);
```
## stampFile()
Fingerprint a file on your machine.

Expand Down
33 changes: 33 additions & 0 deletions docs/guide/receipts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
## Structure
The `receipt` object is an object returned by many methods of the BitFact library. It contains important information about the data recorded on blockchain. At the very least the receipt object contains a `txid` and `hash`. A `meta` sub-object may be given but the information contained inside in not guaranteeed.

## Example
```javascript
{
txid: '0x00188a9f1b03aafaa0bb38f7188dc5d0afc7ba8190336ea9352c9b1823e0fce9',
hash: '7f83b1657ff1fc53b92dc18148a1d65dfc2d4b1fa3d677284addd200126d9069',
meta: {
info: { chain: 'ropsten' },
fact: {
algo: 'sha256',
hash: '7f83b1657ff1fc53b92dc18148a1d65dfc2d4b1fa3d677284addd200126d9069',
type: 'text',
memo: 'hello world memo'
},
tx: {
blockHash: '0x54faf738ed12cd0303585875fc145340293f890410dc4848c9fcd9d386c56bee',
blockNumber: 9230680,
contractAddress: null,
cumulativeGasUsed: 2389412,
from: '0x9bdf7a7f7fdf391b6efd32d16c2594ade09ff041',
gasUsed: 23240,
logs: [],
logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
status: true,
to: '0x00000000000000000000000000000000000000bf',
transactionHash: '0x00188a9f1b03aafaa0bb38f7188dc5d0afc7ba8190336ea9352c9b1823e0fce9',
transactionIndex: 23
}
}
}
```
13 changes: 13 additions & 0 deletions docs/guide/troubleshooting.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## Common Errors
This page documents a list of common errors that you may run into (and their possible solutions) when using the BitFact library.

### Invalid Sender
```javascript
UnhandledPromiseRejectionWarning: Error: Returned error: invalid sender
at Object.ErrorResponse (/BitFact/node_modules/web3-core-helpers/lib/errors.js:28:19)
```

This error occurse when the privateKey for a given account does not have any Ethereum in their respective account.

- Verify that the account specified by `privateKey` has enough Ethereum.
- Verify the { chain: } parameter is being specified in the BitFact constructor.
2 changes: 1 addition & 1 deletion examples/createBitFactText.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ console.log(theKeys);

// creates a BitFact
(async () => {
const bitfact = new BitFact(theKeys);
const bitfact = new BitFact(theKeys,{chain:'ropsten'});
const receipt = await bitfact.stampText("Hello World!", "hello world memo");
console.log(receipt);
})();

0 comments on commit 72c66ef

Please sign in to comment.