From 87a186c8a9286a834f748de6172bf2f0de1049b5 Mon Sep 17 00:00:00 2001 From: zjubfd <296179868@qq.com> Date: Wed, 15 Feb 2023 20:14:36 +0800 Subject: [PATCH] docs: build the framework of docs --- docs/architecture/01-framework.md | 1 + docs/architecture/02-key_management.md | 0 docs/architecture/03-token_economics.md | 0 .../04-storage_provider_management.md | 0 .../05-storage-metadata-models.md | 0 docs/architecture/06-billing_and_payment.md | 0 docs/architecture/07-cross-chain.md | 0 docs/architecture/08-consensus_and_staking.md | 0 docs/architecture/09-governance.md | 0 .../10-data-availability-challenge.md | 0 .../architecture/11-events_and_api.md | 0 docs/architecture/readme.md | 16 +++ docs/tutorial/01-join-mainnet.md | 0 docs/tutorial/02-join-testnet.md | 0 docs/tutorial/03-local-network.md | 0 docs/tutorial/04-key-management.md | 0 docs/tutorial/05-bank.md | 0 docs/tutorial/06-storage.md | 0 docs/tutorial/07-storage-provider.md | 0 docs/tutorial/08-payment.md | 0 docs/tutorial/09-validator-staking.md | 0 docs/tutorial/10-governance.md | 0 docs/tutorial/readme.md | 15 ++ readme.md | 128 ++++++++++++++---- 24 files changed, 136 insertions(+), 24 deletions(-) create mode 100644 docs/architecture/01-framework.md create mode 100644 docs/architecture/02-key_management.md create mode 100644 docs/architecture/03-token_economics.md create mode 100644 docs/architecture/04-storage_provider_management.md create mode 100644 docs/architecture/05-storage-metadata-models.md create mode 100644 docs/architecture/06-billing_and_payment.md create mode 100644 docs/architecture/07-cross-chain.md create mode 100644 docs/architecture/08-consensus_and_staking.md create mode 100644 docs/architecture/09-governance.md create mode 100644 docs/architecture/10-data-availability-challenge.md rename events.md => docs/architecture/11-events_and_api.md (100%) create mode 100644 docs/architecture/readme.md create mode 100644 docs/tutorial/01-join-mainnet.md create mode 100644 docs/tutorial/02-join-testnet.md create mode 100644 docs/tutorial/03-local-network.md create mode 100644 docs/tutorial/04-key-management.md create mode 100644 docs/tutorial/05-bank.md create mode 100644 docs/tutorial/06-storage.md create mode 100644 docs/tutorial/07-storage-provider.md create mode 100644 docs/tutorial/08-payment.md create mode 100644 docs/tutorial/09-validator-staking.md create mode 100644 docs/tutorial/10-governance.md create mode 100644 docs/tutorial/readme.md diff --git a/docs/architecture/01-framework.md b/docs/architecture/01-framework.md new file mode 100644 index 000000000..db4b8eafa --- /dev/null +++ b/docs/architecture/01-framework.md @@ -0,0 +1 @@ +# Framework \ No newline at end of file diff --git a/docs/architecture/02-key_management.md b/docs/architecture/02-key_management.md new file mode 100644 index 000000000..e69de29bb diff --git a/docs/architecture/03-token_economics.md b/docs/architecture/03-token_economics.md new file mode 100644 index 000000000..e69de29bb diff --git a/docs/architecture/04-storage_provider_management.md b/docs/architecture/04-storage_provider_management.md new file mode 100644 index 000000000..e69de29bb diff --git a/docs/architecture/05-storage-metadata-models.md b/docs/architecture/05-storage-metadata-models.md new file mode 100644 index 000000000..e69de29bb diff --git a/docs/architecture/06-billing_and_payment.md b/docs/architecture/06-billing_and_payment.md new file mode 100644 index 000000000..e69de29bb diff --git a/docs/architecture/07-cross-chain.md b/docs/architecture/07-cross-chain.md new file mode 100644 index 000000000..e69de29bb diff --git a/docs/architecture/08-consensus_and_staking.md b/docs/architecture/08-consensus_and_staking.md new file mode 100644 index 000000000..e69de29bb diff --git a/docs/architecture/09-governance.md b/docs/architecture/09-governance.md new file mode 100644 index 000000000..e69de29bb diff --git a/docs/architecture/10-data-availability-challenge.md b/docs/architecture/10-data-availability-challenge.md new file mode 100644 index 000000000..e69de29bb diff --git a/events.md b/docs/architecture/11-events_and_api.md similarity index 100% rename from events.md rename to docs/architecture/11-events_and_api.md diff --git a/docs/architecture/readme.md b/docs/architecture/readme.md new file mode 100644 index 000000000..8aa08df74 --- /dev/null +++ b/docs/architecture/readme.md @@ -0,0 +1,16 @@ +## Overview +This section dives into the internals of the Greenfield Blockchain implementation. + +### Table of Contents + +- [Framework](./01-framework.md) +- [Key Management](./02-key_management.md) +- [Token Economics](./03-token_economics.md) +- [Storage Provider Management](./04-storage_provider_management.md) +- [Storage Metadata Models](./05-storage-metadata-models.md) +- [Billing and Payment](./06-billing_and_payment.md) +- [Cross Chain](./07-cross-chain.md) +- [Consensus and Staking](./08-consensus_and_staking.md) +- [Governance](./09-governance.md) +- [Data Availability Challenge](./10-data-availability-challenge.md) +- [Event and API](./11-events_and_api.md) \ No newline at end of file diff --git a/docs/tutorial/01-join-mainnet.md b/docs/tutorial/01-join-mainnet.md new file mode 100644 index 000000000..e69de29bb diff --git a/docs/tutorial/02-join-testnet.md b/docs/tutorial/02-join-testnet.md new file mode 100644 index 000000000..e69de29bb diff --git a/docs/tutorial/03-local-network.md b/docs/tutorial/03-local-network.md new file mode 100644 index 000000000..e69de29bb diff --git a/docs/tutorial/04-key-management.md b/docs/tutorial/04-key-management.md new file mode 100644 index 000000000..e69de29bb diff --git a/docs/tutorial/05-bank.md b/docs/tutorial/05-bank.md new file mode 100644 index 000000000..e69de29bb diff --git a/docs/tutorial/06-storage.md b/docs/tutorial/06-storage.md new file mode 100644 index 000000000..e69de29bb diff --git a/docs/tutorial/07-storage-provider.md b/docs/tutorial/07-storage-provider.md new file mode 100644 index 000000000..e69de29bb diff --git a/docs/tutorial/08-payment.md b/docs/tutorial/08-payment.md new file mode 100644 index 000000000..e69de29bb diff --git a/docs/tutorial/09-validator-staking.md b/docs/tutorial/09-validator-staking.md new file mode 100644 index 000000000..e69de29bb diff --git a/docs/tutorial/10-governance.md b/docs/tutorial/10-governance.md new file mode 100644 index 000000000..e69de29bb diff --git a/docs/tutorial/readme.md b/docs/tutorial/readme.md new file mode 100644 index 000000000..38e6071bc --- /dev/null +++ b/docs/tutorial/readme.md @@ -0,0 +1,15 @@ +## Overview +This section provides the detailed usage of each module, runbook of testnet/mainnet, and rich examples. + +### Table of Contents + +- [Join the Mainnet](./01-join-mainnet.md) +- [Join the Testnet](./02-join-testnet.md) +- [Setup Private Network](./03-local-network.md) +- [Key Management](./04-key-management.md) +- [Bank](./05-bank.md) +- [Storage](./06-storage.md) +- [Storage Provider](./07-storage-provider.md) +- [Payment](./08-payment.md) +- [Validator and Staking](./09-validator-staking.md) +- [Governance](./10-governance.md) diff --git a/readme.md b/readme.md index 1088ebd18..30ff71532 100644 --- a/readme.md +++ b/readme.md @@ -1,38 +1,118 @@ # Greenfield -Greenfield is a decentralized storage platform proposed to meet the requirements of storing non-financial information for -decentralized applications integrated with BNB Smart Chain. +Official Golang implementation of the Greenfield Blockchain. It uses [tendermint](https://github.com/tendermint/tendermint/) f +or consensus and build on [cosmos-sdk](https://github.com/cosmos/cosmos-sdk). -**Greenfield** is a blockchain built using Cosmos SDK and Tendermint and created with [Ignite CLI](https://ignite.com/cli). +BNB Greenfield targets to facilitate the decentralized data economy. It tries to achieve it by easing the process to store +and manage data access and linking data ownership with the massive DeFi context of BSC. -## Get started +It focuses on 3 parts that differ from existing centralized and decentralized storage systems: +- It enables Ethereum-compatible addresses to create and manage both data and token assets. +- It natively links data permissions and management logic onto BSC as exchangeable assets and smart contract programs with all other assets. +- It provides developers with similar API primitives and performance as popular existing Web2 cloud storage. -``` -# To install the ignite binary in /usr/local/bin run the following command: -curl https://get.ignite.com/cli | bash -export PATH=$GOROOT/bin:$GOPATH/bin:$PATH -ignite chain serve -``` +Enjoys the journey! + + +## Disclaimer +**The software and related documentation are under active development, all subject to potential future change without +notification and not ready for production use. The code and security audit have not been fully completed and not ready +for any bug bounty. We advise you to be careful and experiment on the network at your own risk. Stay safe out there.** + +## Greenfield Core + +The center of BNB Greenfield are two layers: +1. A new storage-oriented blockchain, and +2. network composed of "storage providers". + +This repo is the official implementation of Greenfield blockchain. -`serve` command installs dependencies, builds, initializes, and starts Greenfield in development. +The BNB Greenfield blockchain maintains the ledger for the users and the storage metadata as the common blockchain state data. +It has BNB, transferred from BNB Smart Chain, as its native token for gas and governance. BNB Greenfield blockchain also has +its own staking logic for governance. -### Configure +The Greenfield blockchain contains two categories of states "on-chain": -Greenfield in development can be configured with `config.yml`. To learn more, see the [Ignite CLI docs](https://docs.ignite.com). +1. Accounts and their BNB balance ledger -## Release -To release a new version of Greenfield, create and push a new tag with `v` prefix. A new draft release with the configured targets will be created. +2. The metadata of the object storage system and SPs, the metadata of the objects stored on this storage system, and the + permission and billing information associated with this storage system. + +Greenfield blockchain transactions can change the above states. These +states and the transactions comprise the major economic data of BNB +Greenfield. + +When users want to create and use the data on Greenfield, they may +interact with the BNB Greenfield Core Infrastructure via BNB Greenfield +dApps (decentralized applications). + +## Quick Started + +*Note*: Requires [Go 1.18+](https://go.dev/dl/) ``` -git tag v0.1 -git push origin v0.1 +## Build from source +make build + +## start a private network with 3 validators +$ bash ./deployment/localup/localup.sh all 3 + +## query the key of the first validator +$ ./build/bin/gnfd keys list --home $(pwd)/deployment/localup/.local/validator0 --keyring-backend test + +## get the balance of an account +$ addr=`./build/bin/gnfd keys list --home $(pwd)/deployment/localup/.local/validator0 --keyring-backend test|grep address|awk '{print $3}'` +$ ./build/bin/gnfd q bank balances $addr --node tcp://127.0.0.1:26750 + +## send BNB +$ ./build/bin/gnfd tx bank send validator0 0x73a4Cf67b46D7E4efbb95Fc6F59D64129299c2E3 100bnb --from validator0 -y --node tcp://127.0.0.1:26750 --home $(pwd)/deployment/localup/.local/validator0 -keyring-backend test --broadcast-mode block + +## create a storage bucket +$ ./build/bin/gnfd tx storage create-bucket bucketname 0x73a4Cf67b46D7E4efbb95Fc6F59D64129299c2E3 --from validator0 -y --node tcp://127.0.0.1:26750 --home $(pwd)/deployment/localup/.local/validator0 --keyring-backend test --broadcast-mode block + +## stop the private chain +$ bash ./deployment/localup/localup.sh stop + +## restart the private chain +bash ./deployment/localup/localup.sh start 3 ``` -After a draft release is created, make your final changes from the release page and publish it. +More advanced script and command line usage, please refer to the [Tutorial](./docs/tutorial/readme.md). + +## Key Modules + +- `x/bridge`: provide the cross chain token transfer function. BNB can freely flow between Greenfield and BSC network with native support. +- `x/payment`: handle the billing and payment of storage module. The fees are paid on Greenfield in the style of "Stream" +from users to the Storage Providers(SPs) at a constant rate. The fees are charged every second as they are used. +- `x/sp`: manage the storage provider. +- `x/storage`: user can manage its storage data through this module, like create/delete bucket, create/delete storage object. + +And the following modules are in cosmos-sdk: + +- `x/crosschain`: manage the cross chain packages, like store/query/update the cross chain package, channels, sequences. +- `x/gashub`: provide a governable and predictable fee charge mechanism. +- `x/oracle`: provide a secure runtime for cross chain packages. +- `x/staking`: based on the Proof-of-Stake logic. The elected validators are responsible for the security of the Greenfield blockchain. +They get involved in the governance and staking of the blockchain. + +Refer to the [Architecture Design](./docs/architecture/readme.md) to dive deep into these modules. + +## Join Testnet && Mainnet (coming soon..) + +## Related Projects +- [Greenfield-Contract](https://github.com/bnb-chain/greenfield-contracts): the cross chain contract for Greenfield that deployed on BSC network. +- [Greenfield-Tendermint](https://github.com/bnb-chain/greenfield-tendermint): the consensus layer of Greenfield blockchain. +- [Greenfield-Storage-Provider](https://github.com/bnb-chain/greenfield-storage-provider): the storage service infrastructures provided by either organizations or individuals. +- [Greenfield-Relayer](https://github.com/bnb-chain/greenfield-relayer): the service that relay cross chain package to both chains. +- [Greenfield-Cmd](https://github.com/bnb-chain/greenfield-cmd): the most powerful command line to interact with Greenfield system. +- [Awesome Cosmos](https://github.com/cosmos/awesome-cosmos): Collection of Cosmos related resources which also fits Greenfield. + +## Contribution +Thank you for considering to help out with the source code! We welcome contributions from anyone on the internet, and are +grateful for even the smallest of fixes! -## Learn more +If you'd like to contribute to Greenfield, please fork, fix, commit and send a pull request for the maintainers to review and merge into the main code base. +If you wish to submit more complex changes though, please check up with the core devs first through github issue(going to have a discord channel soon) +to ensure those changes are in line with the general philosophy of the project and/or get some early feedback which can make both your efforts much +lighter as well as our review and merge procedures quick and simple. -- [Ignite CLI](https://ignite.com/cli) -- [Tutorials](https://docs.ignite.com/guide) -- [Ignite CLI docs](https://docs.ignite.com) -- [Cosmos SDK docs](https://docs.cosmos.network) -- [Developer Chat](https://discord.gg/ignite) +## Licence (pending)