0

I have created custom blockchain using go-ethereum

My network has 2 miners nodes with unlocked accounts and then a public node with a locked account that only broadcast transactions to the miners

I run the public node like this:

geth --datadir standard1/ --syncmode 'full' --port 30392 --rpc --rpcport 9578 --rpccorsdomain '*' --rpcaddr 'MY PUBLIC ADDRESS HERE' --ws --wsaddr "MY PUBLIC ADDRESS HERE" --wsorigins "*" --wsport 9579 --wsapi 'db,eth,net,web3,txpool,miner' --networkid 22 --gasprice '1' 

The thing is that if someone sends a contract creation to the public node (using MyEtherWallet for example) the contract submition will be broadcasted and mined.

I found this: https://ethereum.stackexchange.com/questions/11091/is-there-any-way-to-disable-contract-creation-on-a-private-network

But..

a. how can a miner filter the transactions? do i need to create my own fork of go-ethereum with specific logic for this?

b. Is there any way to limit the contract creations? or a way to allow only one contract deployed?

c. I can query the transactions using web3js and check for contract creations, but is there a way to delete the contracts if i own the mining/sealers nodes?

d. Maybe i can ban an address that is submitting a contract? is that possible?

Marcos Martínez
  • 545
  • 2
  • 9
  • 24

2 Answers2

0

I think in Ethereum it is not possible to control who can send transactions as it is an open network and public blockchain. If you are looking to implement this think you have to switch to a private blockchain, I'd recommend hyperledger.

Even if you fork geth anyone who has access to the genesis file and everything can connect to the network and then mine the contract creation transactions on his nodes.

Paradox
  • 327
  • 3
  • 19
  • My idea was to create a fork where the contract deployment transaction will be filtered to be accepted only if they are sent from some specific addresses. Then, i can prevent other nodes join the network if they dont get the genesis file. Also go-ethereum has a maximum amount of peers, so i can set it to a limit of the nodes that i have control of. – Marcos Martínez Nov 04 '18 at 03:33
  • In that case, I think you have no other option than fork geth and then modify it such that it only accepts contract creation request from a particular hard-coded address and embed the genesis file into the binary then distribute the binary to everyone else for them to be able to connect to your network. – Paradox Nov 05 '18 at 07:20
  • But if you want to implement something like this why dont you go with hypeledger? It'll be easier. – Paradox Nov 05 '18 at 07:22
  • Yes, for now is the only way i found. The ethereum election was a requirement :P – Marcos Martínez Nov 05 '18 at 14:42
0

If you are willing to put in some development work, you can fork geth to remove the CREATE and CREATE2 opcodes. By doing so you could remove the ability to create new opcodes.

If you control the majority of hash power on your chain, you could prevent all others from mining transactions with these Opcodes. If someone connects to your chain and mines an invalid transaction, your nodes would drop this block as invalid and continue to mine your blocks.