As explained here, a smart contract is deployed on the blockchain via a transaction, with the following code:

var primaryAddress = eth.accounts[0]
var abi = [{ constant: false, inputs: { name: 'a', type: 'uint256' } }]
var MyContract = eth.contract(abi)
var contract = MyContract.new(arg1, arg2, ..., {from: primaryAddress, data: evmByteCodeFromPreviousSection})

But is it also possible to send it to someone if I know his address wallet? Because he will be the principal user of this smart contract.

Or should the smart contract send a transaction to him with its address once it is mined?


In this case, can the user can have access to the smart contract since he is not the owner?



2 Answers 2


There is no such thing as sending a contract. Contracts are created. Address of new contract is determined by address and nonce of the contract creator.

But you can send some arguments (e.g. principal user's address) when creating a contract. Those arguments will be passed to contract's constructor (see solidity docs):

pragma solidity ^0.4.0;

contract Test {
    address primaryUser;

    function Test(address _primaryUser) {
        primaryUser = _primaryUser;

Contract creation:

var testContract = web3.eth.contract(abi);
var test = testContract.new(
   _primaryUser, /* constructor argument here */
   { from: web3.eth.accounts[0], 
     data: bytecode, 
     gas: '4700000'

Everyone knowing contract's address can send transactions to it.

  • Thanks for your answer. But I think you do also need the ABI right? Should I also send it to the user too? Jan 16, 2017 at 9:27
  • Yes, that is correct. User needs ABI to call contract's functions. You can register source and ABI on etherscan: etherscan.io/contractsVerified Jan 16, 2017 at 10:41

after you deploy(mined) your contract within the blockchain, you give your user its address, not the contract code.

Think of it like if you've setup a website and you give the user the URL not the website code (this is nonsense unless you collaborate on the code).

Concerning the access, while your contract is deployed it is accessible by anyone : it is public, all they need is the contract address to interact with it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.