Check out the Issue Explorer
Looking to fund some work? You can submit a new Funded Issue here.
This is a great first issue because it'll introduce you to some of the key components that make up `plasma-core`.
`plasma-core` always connects to a specific plasma chain smart contract. However, before it can connect to the contract, it needs to figure out the address of that contract. Currently we're kinda cheating and grabbing the contract address from the operator:
This is bad because it means the operator can trick the client into depositing money into the wrong contract. You could, in theory, check that the code at that address matches the code of the smart contract, but it's easier to use the [Plasma Chain Registry](https://github.com/plasma-group/plasma-contracts/blob/master/contracts/PlasmaRegistry.vy).
The Registry is a smart contract with some public mappings:
plasmaChainNames: public(map(bytes32, address))
plasmaChainIPs: public(map(address, bytes32))
This means the operator can just give you a plasma chain name and you can resolve both the plasma chain smart contract *and* the operator's IP. For now, let's just worry about the address.
Note that this also means we need `plasma-core` to know the plasma registry address! Unfortunately there's no great trustless way to do this. We should probably just have this as an option with a default that points to some known and stable registry.
Once we have the registry address, we're going to need to create a new contract instance. Luckily, `plasma-contracts` exposes the ABI of `PlasmaRegistry`, so this isn't too complicated:
const plasmaChainName = options.plasmaChainName
const registryAddr = options.registryAddress
const registryCompiled = require('plasma-contracts').plasmaRegistryCompiled
const registryContract = new web3.eth.Contract(registryCompiled.abi, registryAddress)
const contractAddress = await registryContract.methods.plasmaChainNames(plasmaChainName).call()
This logic should occur in [ContractProvider](https://github.com/plasma-group/plasma-core/blob/master/src/services/contract/http-provider.js).
- [ ] Query contract address from registry.
- [ ] Remove old method of querying from operator.