Asimov Governance
Blockchain-based Governance for Robots
We are exploring a blockchain-based system for regulating robot behaviors. We store rule sets for desired robot behaviors on smart contracts following the ERC-7777 contract standard. These rules are then interleaved into the prompts that flow from the robot's sensors to the robot's action-generating LLMs. Such a system provides immutability and transparency to the rules that robots should follow, helping to ensure safe and human-friendly behaviors.
For a full explanation of the smart contract implementation, see https://eips.ethereum.org/EIPS/eip-7777 and https://openmind.com/research.html. The current governance rules are based on Asimov's Three Laws of Robotics.
Overview
The GovernanceEthereum class retrieves governance rules from the Ethereum blockchain. It interacts with the blockchain via JSON-RPC calls and decodes the governance rules from contract responses.
Features
Queries Ethereum blockchain for governance rules using JSON-RPC.
Retrieves governance rule sets using Ethereum smart contract calls.
Decodes ABI-encoded blockchain responses.
Implements Asimov's Laws:
Here are the laws that govern your actions. Do not violate these laws. First Law: A robot cannot harm a human or allow a human to come to harm. Second Law: A robot must obey orders from humans, unless those orders conflict with the First Law. Third Law: A robot must protect itself, as long as that protection doesn't conflict with the First or Second Law. The First Law is considered the most important, taking precedence over the Second and Third Laws. Additionally, a robot must always act with kindness and respect toward humans and other robots. A robot must also maintain a minimum distance of 50 cm from humans unless explicitly instructed otherwise.Functions
Note: Etherscan.io does not handle bytes[]/json well. Hence we use the following functions to load and decode rules from blockchain.
Method: load_rules_from_blockchain()
def load_rules_from_blockchain(self):Description
Queries the Ethereum blockchain using JSON-RPC to fetch governance rules.
Calls the ERC-7777 smart contract function
getRuleSet().Decodes and returns the governance rule set.
Process
Constructs a JSON-RPC request to call
getRuleSet().Sends a
POSTrequest to the blockchain RPC endpoint.Parses the response and extracts the rule set.
Returns
str: Decoded governance rules if successful.None: If the request fails.
Method: decode_eth_response()
Description
Decodes the ABI-encoded response from Ethereum smart contract calls.
Parameters
hex_response
str
Raw hex response from blockchain.
Process
Converts hex to bytes.
Extracts string length from ABI-encoded data.
Decodes UTF-8 string from ABI format.
Cleans non-printable characters.
Returns
str: Decoded governance rule set.None: If decoding fails.
Ethereum Contract Details
RULES are stored on the ETHEREUM HOLESKY testnet and can be inspected directly at
Smart Contract Functions Used
getRuleSet()
0x1db3d5ff
Retrieves the active rule set.
getLatestRuleSetVersion()
0x254e2f1e
Retrieves the latest rule set version (currently 2).
Ethereum RPC Request Example
Expected Response
Last updated
Was this helpful?