Use the HelloWorld plugin
This tutorial shows you how to use the HelloWorld plugin, which exposes a JSON-RPC endpoint to return a greeting message in Spanish.
The plugin interface is implemented in Go and Java. The plugin can reload changes from its JSON configuration.
Prerequisites
- GoQuorum built from source
- Gox installed
Build the plugin distribution file
- 
Clone the plugin repository: git clone --recursive https://github.com/ConsenSys/quorum-plugin-hello-world.git
 cd quorum-plugin-hello-world
- 
Use the Go implementation of the plugin: cd go
 makequorum-plugin-hello-world-1.0.0.zipis now created in thebuilddirectory. The filehello-world-plugin-config.jsonis the JSON configuration file for the plugin.
- 
Rename quorum-plugin-hello-world-1.0.0.zipaccording to your operating system:
- Linux
- MacOS
quorum-plugin-hello-world-1.0.0-linux-amd64.zip
quorum-plugin-hello-world-1.0.0-darwin-amd64.zip
Start GoQuorum with plugin support
- 
Navigate to your GoQuorum installation directory. Copy the HelloWorldplugin distribution file and its JSON configurationhello-world-plugin-config.jsontobuild/bin.
- 
Create geth-plugin-settings.json:cat > build/bin/geth-plugin-settings.json <<EOF
 {
 "baseDir": "./build/bin",
 "providers": {
 "helloworld": {
 "name":"quorum-plugin-hello-world",
 "version":"1.0.0",
 "config": "file://./build/bin/hello-world-plugin-config.json"
 }
 }
 }
 EOFnoteFor the configured locations, ./means that you start from the working directory, from where the program is launched.
- 
Run gethwith the plugin:PRIVATE_CONFIG=ignore \
 geth \
 --nodiscover \
 --verbosity 5 \
 --networkid 10 \
 --raft \
 --raftjoinexisting 1 \
 --datadir ./build/_workspace/test \
 --http \
 --http.api eth,debug,admin,net,web3,plugin@helloworld \
 --plugins file://./build/bin/geth-plugin-settings.json \
 --plugins.skipverifyRun ps -ef | grep helloworldto reveal theHelloWorldplugin process.
Test the plugin
- Test the HelloWorldplugin using the following command:
- curl HTTP request
- JSON result
curl -X POST http://localhost:8545 \
    -H "Content-type: application/json" \
    --data '{"jsonrpc":"2.0","method":"plugin@helloworld_greeting","params":["Quorum Plugin"],"id":1}'
{ "jsonrpc": "2.0", "id": 1, "result": "Hello Quorum Plugin!" }
- 
Update the plugin configuration build/bin/hello-world-plugin-config.jsonto support theeslanguage (Spanish).
- 
Reload the plugin using the following command: 
- curl HTTP request
- JSON result
curl -X POST http://localhost:8545 \
    -H "Content-type: application/json" \
    --data '{"jsonrpc":"2.0","method":"admin_reloadPlugin","params":["helloworld"],"id":1}'
{ "jsonrpc": "2.0", "id": 1, "result": true }
- Re-run the HelloWorldplugin:
- curl HTTP request
- JSON result
curl -X POST http://localhost:8545 \
    -H "Content-type: application/json" \
    --data '{"jsonrpc":"2.0","method":"plugin@helloworld_greeting","params":["Quorum Plugin"],"id":1}'
{ "jsonrpc": "2.0", "id": 1, "result": "Hola Quorum Plugin!" }