docs: update links and flow
This commit is contained in:
parent
7335c8287c
commit
b7ef4652ed
|
@ -125,7 +125,7 @@ which is only useful for moving tokens around.
|
|||
Fortunately, Basecoin supports another transaction type, the `AppTx`,
|
||||
which can trigger code registered via a plugin system.
|
||||
|
||||
In the [next tutorial](example-counter.md),
|
||||
In the [next tutorial](example-plugin.md),
|
||||
we demonstrate how to implement a plugin
|
||||
and extend the CLI to support new transaction types!
|
||||
But first, you may want to learn a bit more about [Basecoin's design](basecoin-design.md)
|
||||
|
|
|
@ -14,11 +14,26 @@ This type of account was directly inspired by accounts in Ethereum,
|
|||
and is unlike Bitcoin's use of Unspent Transaction Outputs (UTXOs).
|
||||
Note Basecoin is a multi-asset cryptocurrency, so each account can have many different kinds of tokens.
|
||||
|
||||
```
|
||||
type Account struct {
|
||||
PubKey crypto.PubKey `json:"pub_key"` // May be nil, if not known.
|
||||
Sequence int `json:"sequence"`
|
||||
Balance Coins `json:"coins"`
|
||||
}
|
||||
|
||||
type Coins []Coin
|
||||
|
||||
type Coin struct {
|
||||
Denom string `json:"denom"`
|
||||
Amount int64 `json:"amount"`
|
||||
}
|
||||
```
|
||||
|
||||
Accounts are serialized and stored in a Merkle tree using the account's address as the key,
|
||||
where the address is the RIPEMD160 hash of the public key.
|
||||
In particular, an account is stored in the Merkle tree under the key `base/a/<address>`,
|
||||
where `<address>` is the 20-byte address of the account.
|
||||
We use an implementation of a Merkle, balanced, binary search tree, also known as an [IAVL tree](https://github.com/tendermint/go-merkle).
|
||||
where `<address>` is the address of the account.
|
||||
In Basecoin, the address of an account is the 20-byte `RIPEMD160` hash of the public key.
|
||||
The Merkle tree used in Basecoin is a balanced, binary search tree, which we call an [IAVL tree](https://github.com/tendermint/go-merkle).
|
||||
|
||||
## Transactions
|
||||
|
||||
|
@ -47,14 +62,6 @@ type TxOutput struct {
|
|||
Address []byte `json:"address"` // Hash of the PubKey
|
||||
Coins Coins `json:"coins"` //
|
||||
}
|
||||
|
||||
type Coins []Coin
|
||||
|
||||
type Coin struct {
|
||||
Denom string `json:"denom"`
|
||||
Amount int64 `json:"amount"`
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
There are a few things to note. First, the `SendTx` includes a field for `Gas` and `Fee`.
|
||||
|
@ -72,10 +79,9 @@ as it uses a different elliptic curve scheme which enables the public key to be
|
|||
Finally, note that the use of multiple inputs and multiple outputs allows us to send many different types of tokens between many different accounts
|
||||
at once in an atomic transaction. Thus, the `SendTx` can serve as a basic unit of decentralized exchange.
|
||||
|
||||
## Next steps
|
||||
## Plugins
|
||||
|
||||
1. Make your own [cryptocurrency using Basecoin plugins](example-counter.md)
|
||||
1. Learn more about [plugin design](plugin-design.md)
|
||||
1. See some [more example applications](more-examples.md)
|
||||
1. Learn how to use [InterBlockchain Communication (IBC)](ibc.md)
|
||||
1. [Deploy testnets](deployment.md) running your basecoin application.
|
||||
Basecoin actually defines a second transaction type, the `AppTx`,
|
||||
which enables the functionality to be extended via custom plugins.
|
||||
To learn more about the `AppTx` and plugin system, see the [plugin design document](plugin-design.md).
|
||||
To implement your first plugin, see [plugin tutorial](example-plugin.md).
|
||||
|
|
|
@ -409,11 +409,12 @@ This is a Merkle proof that the state is what we say it is.
|
|||
In a latter [tutorial on Interblockchain Communication](ibc.md),
|
||||
we'll put this proof to work!
|
||||
|
||||
## Conclusion
|
||||
## Next Stpes
|
||||
|
||||
In this tutorial we demonstrated how to create a new plugin and how to extend the
|
||||
basecoin CLI to activate the plugin on the blockchain and to send transactions to it.
|
||||
Hopefully by now you have some ideas for your own plugin, and feel comfortable implementing them.
|
||||
|
||||
In the [next tutorial](more-examples.md), we tour through some other plugin examples,
|
||||
adding features for minting new coins, voting, and changin the Tendermint validator set.
|
||||
But first, you may want to learn a bit more about [the design of plugins](plugin-design.md)
|
||||
But first, you may want to learn a bit more about [the design of the plugin system](plugin-design.md)
|
||||
|
|
|
@ -64,9 +64,8 @@ and also to store arbitrary other information in the state.
|
|||
In this way, the functionality and state of a Basecoin-derrived cryptocurrency can be greatly extended.
|
||||
One could imagine going so far as to implement the Ethereum Virtual Machine as a plugin!
|
||||
|
||||
## Examples
|
||||
|
||||
## Next steps
|
||||
|
||||
1. Examples of [Basecoin plugins](more-examples.md)
|
||||
1. Learn how to use [InterBlockchain Communication (IBC)](ibc.md)
|
||||
1. [Deploy testnets](deployment.md) running your basecoin application.
|
||||
To get started with plugins, see [the example-plugin tutorial](example-plugin.md).
|
||||
For more examples, see [the advanced plugin tutorial](more-examples.md).
|
||||
If you're really brave, see the tutorial on [implementing Interblockchain Communication as a plugin](ibc.md).
|
||||
|
|
Loading…
Reference in New Issue