Simple Node

Every domain name will store data in GUN as per the following schema:

const gun = Gun({
    peers: ['gun-seed-1.auti.sm/gun'],
});

gun.user().auth({
    pub: 'my-public-key',
    priv: 'my-private-key',
});

user.put({  
    message: {  
    	[messageHash]: Message  
    }  
});  

Anyone can run a client and observe the AutismRegister contract to get all names with a valid pubkey record, and then observe and store all updates from the public key associated with the identity to provide reliable data duplication for the network:

const contractABI = [
    {
        "anonymous": false,
        "inputs": [
            {
                "indexed": true,
                "internalType": "address",
                "name": "account",
                "type": "address"
            },
            {
                "indexed": false,
                "internalType": "bytes",
                "name": "value",
                "type": "bytes"
            },
            {
                "indexed": false,
                "internalType": "bytes",
                "name": "proof",
                "type": "bytes"
            },
            {
                "indexed": false,
                "internalType": "address",
                "name": "relayer",
                "type": "address"
            }
        ],
        "name": "RecordUpdatedFor",
        "type": "event"
    }
];

const contractAddress = "0x6b0a11F9aA5aa275f16e44e1D479A59dd00abE58";

const registrar = new new Web3().eth.Contract(
    contractABI,
    contractAddress,
);

const gun = Gun({
    peers: ['gun-seed-1.auti.sm/gun'],
});

registrar
    .getPastEvents('RecordUpdatedFor', {
        fromBlock: 2193241,
    })
    .forEach(event => {
        const pubkeyBytes = event.returnValues.value;
        const account = event.returnValues.account;
        const pubkey = Web3.utils.hexToUtf8(pubkeyBytes);
        const user = gun.user(ecdsaPubKey);
        
        user.get('message')
            .map((data, messageId) => {
                // data = Message
                // messageId = "<creator>/<messageHash>"
            });
    });
    

By default, we will run 2 full nodes in North America, 2 in Asia, and 2 in Europe to provide reliable global coverage. These 6 nodes will become the bootstrap peers for anyone trying to connect to Autism.

Last updated