🪢

v4 Node Setup & Registration

 
This guide is for for those who want to become a pNetwork v4 Node.

Requirements

  • Any Android device, better if they include a secure chip (i.e. Google Pixels, Samsung Knox, etc)

Node Setup

  1. Setup the Event Attestator, the API and Tee Wrapper Android by following the README.md instructions placed into each projects’ root.
  1. Build the Event Attestator JSONRPC app
    1. cd tee-wrapper-android cargo build --release --bin jsonrpc-app
  1. Download the latest signed APK from the proofcastlabs/tee-wrapper-android releases page
  1. Verify the APK contains the SHA-256 digest claimed into the release
    1. apksigner verify --print-certs tee-wrapper-android.apk
      Signer #1 certificate DN: CN=Unknown, OU=Security Council, O=pNetwork, L=Unknown, ST=Unknown, C=Unknown Signer #1 certificate SHA-256 digest: d02c234a4e016ff6b06863a1ce56439453b7c768ab2b9f87352ff19d9b66ecca Signer #1 certificate SHA-1 digest: cfdfa9b3c61b2c48458e54a61efb7b187be5643b Signer #1 certificate MD5 digest: 472f66d1fc7ebe82dbbb3c69ad56c1f1
  1. Connect the device and install the APK
    1. cd tee-wrapper-android ./scripts/connect-device.sh adb install /path/to/tee-wrapper-android.apk
  1. Configure the nodes based on your needs and adding the chains you’d like to support
    1. Example config.toml
      [log] # Path to the logs path = "./app.log" level = "debug" enabled = true max_log_size = 1_000_000_000 max_num_logs = 1 use_file_logging = false [core] timeout = 5 rpc_server_address = "127.0.0.1:3030" [networks.eth] # ETH client nodes (quicknode custom RPC is supported and automatically detected) endpoints = ["ws://127.0.0.1:8080"] sleep_duration = 10 network_id = "ethereum" validate = true gas_limit = 0 batch_size = 2 batch_duration = 0 pre_filter_receipts = false # Events to be listen to events = [ ["0xeD1DB453C3156Ff3155a97AD217b3087D5Dc5f6E", "0x9b706941b48091a1c675b439064f40b9d43c577d9c7134cce93179b9b0bf2a52"], ] [networks.bsc] pnetwork_hub = "0x0000000000000000000000000000000000000000" # BSC client nodes (quicknode custom RPC is supported and automatically detected) endpoints = ["ws://127.0.0.1:8081"] sleep_duration = 10 network_id = "bsc" validate = true gas_limit = 0 batch_size = 2 batch_duration = 0 pre_filter_receipts = false events = [ ["0xe1DA8919f262Ee86f9BE05059C9280142CF23f48", "0x9b706941b48091a1c675b439064f40b9d43c577d9c7134cce93179b9b0bf2a52"], ] [mongo] enabled = true index = "event_id" uri_str = "mongodb://localhost:27017/" database = "event-attestator" collection = "signed-events"
    1. Run the JSONRPC app
      1. ./jsonrpc-app -c config.toml
    1. Move the event-attestator-api repository start the app and initialise each chain
      1. ./scripts/launch.sh <device-id> # Initialize ./scripts/rpc.sh init false 0x393ad7Bd0B94788b3B9EB15303E3845B4828E7Fb 50 10 bsc ./scripts/rpc.sh init false 0x393ad7Bd0B94788b3B9EB15303E3845B4828E7Fb 50 10 eth
        Notes
        • You can place for 0x393ad7Bd0B94788b3B9EB15303E3845B4828E7Fb any other address you like, since it’s not used within the code. It’ll be removed in the future.
        • You can check if the app is running by executing
          • ./scripts/logcat.sh
         
    1. Run the event attestator api:
      1. cd event-attestator-api docker-compose up
        Notes
        In general is not ideal to use your serve IP when sharing the event attestator API. You will need to map it to public domain, this way you can keep the URL fixed and change the server IP in case.
     

    Node update

    Whenever a new APK is released by the Security Council on public channels, the app required to be uninstalled and re-installed again. The procedure consists in:
    1. Stop the api
      1. cd event-attestator-api docker compose stop
    1. Stop the event-attestator and uninstall the app from the device
      1. ./scripts/stop.sh adb uninstall proofcastlabs.tee
    1. Re-execute the steps from 5. in the Node’s Setup section.

    On-chain registration

    The overall on-chain registration procedure is divided into two parts:
    1. Node’s registration on the DAO contracts on Ethereum
    1. Node’s endpoint registration on Polygon contract
    Important:
    • Both registrations are required in order to run a pNetwork v4 node
    • Even if you had a pNetwork v2 node in the past on Ethereum you must register your new v4 node again

    1. DAO node registration (on Ethereum)

    In order to register your node on the DAO you need to:
    1. Execute the following command in the event-attestator-api folder:
      1. ./scripts/rpc.sh getNodeRegistration
        Note:
        Be sure to have set the owner_address configurable with your staking address in the config.toml
    1. The command above will show you the signature to give when interacting with the DAO contracts. Head over here in order to register yourself https://etherscan.io/address/0xed19cc44ac340dc21dd525feefc43d73121c9e05#writeProxyContract
    1. Connect your wallet by pressing on the Connect to Web3 button (be sure to connect with the same wallet you’ve used for the owner_address value in the config.toml)
    1. Go to the method called updateRegistration and insert the signature returned by step 1.
      1. notion image
    1. Press write
    1. Complete the signing of the transaction through your wallet interface and you’re done!

    2. Endpoint registration (on Polygon)

    In order to register your node for pNetwork v4, you’ll need:
    1. Go to the contract here https://polygonscan.com/address/0x228e705ad070def5072d283606d14dad7592377b
    1. Go to the Contract tab
    1. Click Write Contract
    1. Click on Connect to Web3
    1. Connect your DAO’s node registration wallet by using the wallet extension you have installed on your browser
    1. Set your endpoint like follows and click Write
    notion image
    1. Broadcast the transaction and you are done!
    Note
    Remember to repeat the procedure whenever you endpoint URL changes

    Conclusion

    You have completed the registration of your node and you are ready to accrue fees, head to the Fees accrual page in order to understand how to claim them.