System and method for managing user interactions with a blockchain
Methods, systems, and apparatus, including computer programs encoded on computer storage media, for managing user interactions with a blockchain. One of the methods includes: receiving a user input in a command line interface (CLI), wherein the user input comprises a reference to one or more configurations; determining, by a command manager based on the user input, a blockchain-related operation and a command plug-in associated with the blockchain-related operation; generating, by the determined command plug-in, a command based on the determined operation and the one or more configurations; and sending, by a software development kit (SDK) associated with the blockchain, the command to one or more nodes associated with the blockchain.
1. A computer-implemented method for managing user interactions with a blockchain, the method comprising:
receiving a user input in a command line interface (CLI), wherein the user input comprises a reference to one or more configurations;
determining, by a command manager based on the user input, a blockchain-related operation and a command plug-in associated with the blockchain-related operation;
generating, by the determined command plug-in, a command based on the determined operation and the one or more configurations; and
sending, by a software development kit (SDK) associated with the blockchain, the command to one or more nodes associated with the blockchain.
2. The method of claim 1 , further comprising:
obtaining, by the SDK, an output in response to the command from the blockchain; and
providing the output in the CLI.
3. The method of claim 1 , further comprising, before the receiving a user input, initializing a console for managing user interactions with the blockchain, wherein the console comprises a mainframe, the CLI, the command manager, a plurality of command plug-ins, and the SDK, and wherein the initializing comprises:
starting the mainframe associated with the console;
generating, by the mainframe, an instance of the CLI;
initializing, by the CLI, the SDK based on one or more configurations associated with one or more nodes associated with the blockchain;
calling, by the CLI, the command manager; and
loading, by the command manager, the command plug-ins for registration into the instance of the CLI.
4. The method of claim 3 , wherein the console further comprises a tool manager configured to:
calculate a hash value;
calculate a digital signature; or
verify a blockchain transaction.
5. The method of claim 1 , wherein the CLI is configured to:
pre-process the user input;
provide a historical record of user inputs; or
provide a recommended command.
6. The method of claim 1 , wherein:
the command manager is configured to register or remove one or more commands.
7. The method of claim 6 , wherein:
the command manager is configured to provide, in the CLI, a list of registered commands and information about the registered commands.
8. The method of claim 1 , wherein the command plug-in comprises:
a transaction plug-in;
a block plug-in; or
an event plug-in.
9. The method of claim 8 , wherein the transaction plug-in is configured to generate:
a command for adding a blockchain transaction to the blockchain;
a command for querying for information about one or more blockchain transactions associated with the blockchain; or
a command for querying for information about one or more accounts associated with the blockchain.
10. The method of claim 8 , wherein the block plug-in is configured to generate:
a command for querying for information about a block associated with the blockchain; or
a command for querying for information about a block header associated with the blockchain.
11. The method of claim 8 , wherein the event plug-in is configured to generate:
a command for subscribing to events related to a blockchain contract associated with the blockchain;
a command for subscribing to events related to a block associated with the blockchain;
a command for subscribing to events related to an account associated with the blockchain; or
a command for subscribing to events related to a topic associated with the blockchain.
12. The method of claim 1 , wherein the sending the command to one or more nodes associated with the blockchain comprises:
obtaining, from the user input, a reference to the blockchain;
selecting, from a plurality of SDKs, the SDK associated with the referenced blockchain; and
feeding the generated command to the SDK.
13. The method of claim 1 , wherein:
the blockchain is a consortium blockchain.
14. A system for managing user interactions with a blockchain, comprising a processor and a non-transitory computer-readable storage medium storing instructions executable by the processor to cause the system to perform operations comprising:
receiving a user input in a command line interface (CLI), wherein the user input comprises a reference to one or more configurations;
determining, by a command manager based on the user input, a blockchain-related operation and a command plug-in associated with the blockchain-related operation;
generating, by the determined command plug-in, a command based on the determined operation and the one or more configurations; and
sending, by a software development kit (SDK) associated with the blockchain, the command to one or more nodes associated with the blockchain.
15. The system of claim 14 , wherein the operations further comprise:
obtaining, by the SDK, an output in response to the command from the blockchain; and
providing the output in the CLI.
16. The system of claim 14 , wherein the operations further comprise, before the receiving a user input, initializing a console for managing user interactions with the blockchain, wherein the console comprises a mainframe, the CLI, the command manager, a plurality of command plug-ins, and the SDK, and wherein the initializing comprises:
starting the mainframe associated with the console;
generating, by the mainframe, an instance of the CLI;
initializing, by the CLI, the SDK based on one or more configurations associated with one or more nodes associated with the blockchain;
calling, by the CLI, the command manager; and
loading, by the command manager, the command plug-ins for registration into the instance of the CLI.
17. The system of claim 16 , wherein the console further comprises a tool manager configured to:
calculate a hash value;
calculate a digital signature; or
verify a blockchain transaction.
18. The system of claim 14 , wherein the CLI is configured to:
pre-process the user input;
provide a historical record of user inputs; or
provide a recommended command.
19. The system of claim 14 , wherein:
the command manager is configured to register or remove one or more commands.
20. A non-transitory computer-readable storage medium for managing user interactions with a blockchain, configured with instructions executable by one or more processors to cause the one or more processors to perform operations comprising:
receiving a user input in a command line interface (CLI), wherein the user input comprises a reference to one or more configurations;
determining, by a command manager based on the user input, a blockchain-related operation and a command plug-in associated with the blockchain-related operation;
generating, by the determined command plug-in, a command based on the determined operation and the one or more configurations; and
sending, by a software development kit (SDK) associated with the blockchain, the command to one or more nodes associated with the blockchain.