diff --git a/CHANGELOG.md b/CHANGELOG.md index 791fc9712..8028f015e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ TBD ================== +**New features:** + +* Added the `setGraffiti` RPC (POST /api/nimbus/v1/graffiti in the REST API) + **Breaking changes:** * Renamed some semi-internal debug rpc to be more explicit about their nature: diff --git a/beacon_chain/rpc/nimbus_api.nim b/beacon_chain/rpc/nimbus_api.nim index 5106142f1..1a413209f 100644 --- a/beacon_chain/rpc/nimbus_api.nim +++ b/beacon_chain/rpc/nimbus_api.nim @@ -87,6 +87,10 @@ proc installNimbusApiHandlers*(rpcServer: RpcServer, node: BeaconNode) {. updateLogLevel(level) return true + rpcServer.rpc("setGraffiti") do (graffiti: string) -> bool: + node.graffitiBytes = GraffitiBytes.init(graffiti) + return true + rpcServer.rpc("getEth1Chain") do () -> seq[Eth1Block]: result = if node.eth1Monitor != nil: mapIt(node.eth1Monitor.blocks, it) @@ -154,7 +158,6 @@ proc installNimbusApiHandlers*(rpcServer: RpcServer, node: BeaconNode) {. for peer in v: peers.add(peer.toNode(backOff.getOrDefault(peer.peerId))) - gossipsub.add(topic, peers) res.add("gossipsub", gossipsub) diff --git a/docs/the_nimbus_book/src/api.md b/docs/the_nimbus_book/src/api.md index 3fd6ed913..56c3749e5 100644 --- a/docs/the_nimbus_book/src/api.md +++ b/docs/the_nimbus_book/src/api.md @@ -333,6 +333,15 @@ Set the current logging level dynamically: TRACE, DEBUG, INFO, NOTICE, WARN, ERR curl -d '{"jsonrpc":"2.0","id":"id","method":"setLogLevel","params":["DEBUG; TRACE:discv5,libp2p; REQUIRED:none; DISABLED:none"] }' -H 'Content-Type: application/json' localhost:9190 -s | jq ``` +### setGraffiti + +Set the graffiti bytes that will be included in proposed blocks. The graffiti bytes can be +specified as an UTF-8 encoded string or as an 0x-prefixed hex string specifying raw bytes. + +``` +curl -d '{"jsonrpc":"2.0","id":"id","method":"setGraffiti","params":["Mr F was here"] }' -H 'Content-Type: application/json' localhost:9190 -s | jq +``` + ### getEth1Chain Get the list of Eth1 blocks that the beacon node is currently storing in memory.