- Add folder structure
- Add codec
- Add connection
- Add connector
- Add unit tests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// your blockchain constants | |
constants.ts | |
// main logic files with BCP flavor | |
myblockchaincodec.ts | |
myblockchainconnection.ts | |
// this one joins the codec and the connection | |
myblockchainconnector.ts | |
// this exports all | |
index.ts | |
// some test files, don't forget about them |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// On walletFromCodec function add your crypto flawor, | |
// only ed25519 and secp256k1 are supported currently. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// On imports add myblockchain | |
import { myblockchainCodec, myblockchainConnector } from "@iov/myblockchain"; | |
// On enum Codec add MyBlockchain | |
export const enum Codec { | |
MyBlockchain | |
} | |
// On codecFromString function add MyBlockchain codec | |
export function codecFromString(input: string): Codec { | |
switch (input) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// TODO: add some imports | |
import { myblockchainCodec } from "./myblockchaincodec"; | |
import { MyBlockchainConnection } from "./myblockchainconnection"; | |
export function myBlockchainConnector(url, someParameters): ChainConnector { | |
// TODO: add some logic based on your blockchain connection | |
return { | |
client: async () => MyBlockchainConnection.establish(url, someParameters), | |
codec: myblockchainCodec, /** we exported a const here, remember */ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// TODO: imports and functions goes here | |
/** A high-level interface to a blockchain node */ | |
export class MyBlockchainConnection implements BlockchainConnection { | |
public static async establish(myBlockchainParameters): | |
Promise<MyBlockchainConnection> { | |
// TODO: logic to load blockchain parameters (nethash, chainId, etc) | |
return new MyBlockchainConnection(myBlockchainParameters); | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// TODO: imports and functions goes here | |
export const myblockchainCodec: TxCodec = { | |
/** these are the bytes we create to add a signature; | |
* they often include nonce and chainID */ | |
bytesToSign: (unsigned: UnsignedTransaction, nonce: Nonce): SigningJob => { | |
// TODO: write your unsigned transaction serialization recipe | |
return { | |
bytes, /** the serialized transaction */ | |
prehashType /** your crypto flawor from PrehashType: Sha256, Sha512, Keccak256 */ |
I hereby claim:
- I am lucasisasmendi on github.
- I am lucasisasmendi (https://keybase.io/lucasisasmendi) on keybase.
- I have a public key ASCcpuv7J3LwcPZU2UEvXCgeuIDKuyInt-aegjGflMMi5go
To claim this, I am signing this object: