Each transaction has always the two following fields:
The web3 library provides a function called web3.eth.getCode
to retrieve the smart contract code at a given address. If the code returned is 0x
, we can deduce that this is a individual account.
web3.eth.getCode("0x7f6eab1759ab5cae0ba484422406736a884a140d", function(err,res) {
if(err) throw err;
if(res == "0x") {
console.log("Individual Account address ")
} else {
console.log("Smart contract Account address")
}
});
Examples:
https://rinkeby.etherscan.io/address/0x6dff9c7c1a821190c9f3b34a835a01dd58c90af0
>> web3.eth.getCode("0x6dff9c7c1a821190c9f3b34a835a01dd58c90af0", function(err,res) {console.log(res)});
>> 0x
https://rinkeby.etherscan.io/address/0x7f6eab1759ab5cae0ba484422406736a884a140d
>> web3.eth.getCode("0x7f6eab1759ab5cae0ba484422406736a884a140d", function(err,res) {console.log(res)});
>> 0x60806040526004361061013a5763ffffffff60e060020a60003504166301248bef811461013f5780630d0d621d14610166578063126596e7146101f05780631da6c8221461020a5780631df77caa1461021f57806327dc297e1461024057806338bbfa501461029e57806347c49fc11461033a57806355aefde41461034f5780635ec01e4d146103a85780637072a977146103b0578063715018a6146103c55780637a05dfb8146103da57806385c7a9fc1461020a57806388a8d602146103ef5780638da5cb5b1461042057806394aa45a61461013f578063a2e6204514610435578063ab5718b81461043d578063bc1fa7fb14610452578063c0e6249c14610467578063c1a3bda51461047c578063d207e75714610491578063e5e2003c146104af578063f2fde38b146104c4578063fb4a45cf146104e5575b600080fd5b34801561014b57600080fd5b506101546104fa565b60408051918252519081900360200190f35b34801561017257600080fd5b5061017b6104ff565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101b557818101518382015260200161019d565b50505050905090810190601f1680156101e25780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101fc57600080fd5b5061020860043561058d565b005b34801561021657600080fd5b506101546105b0565b34801561022b57600080fd5b50610208600160a060020a03600435166105b5565b34801561024c57600080fd5b5060408051602060046024803582810135601f81018590048502860185019096528585526102089583359536956044949193909101919081908401838280828437509497506106a89650505050505050565b3480156102aa57600080fd5b5060408051602060046024803582810135601f810185900485028601850190965285855261020895833595369560449491939091019190819084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a999881019791965091820194509250829150840183828082843750949750610ca39650505050505050565b34801561034657600080fd5b50610154610ca8565b34801561035b57600080fd5b506040805160206004803580820135601f8101849004840285018401909552848452610208943694929360249392840191908190840183828082843750949750610cad9650505050505050565b610208610cdb565b3480156103bc57600080fd5b50610154610ce5565b3480156103d157600080fd5b50610208610ceb565b3480156103e657600080fd5b5061017b610d4a565b3480156103fb57600080fd5b50610404610d81565b60408051600160a060020a039092168252519081900360200190f35b34801561042c57600080fd5b50610404610d90565b610208610d9f565b34801561044957600080fd5b5061017b611136565b34801561045e57600080fd5b5061015461116d565b34801561047357600080fd5b5061017b611172565b34801561048857600080fd5b506101546111a9565b34801561049d57600080fd5b5061020863ffffffff600435166111af565b3480156104bb57600080fd5b5061017b6111d1565b3480156104d057600080fd5b50610208600160a060020a0360043516611208565b3480156104f157600080fd5b5061017b611228565b600181565b6009805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156105855780601f1061055a57610100808354040283529160200191610585565b820191906000526020600020905b81548152906001019060200180831161056857829003601f168201915b505050505081565b600054600160a060020a031633146105a457600080fd5b6105ad8161124d565b50565b600281565b600054600160a060020a031633146105cc57600080fd5b604080518082019091526013815260008051602061269a8339815191526020820152600160a060020a03821615156106855760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561064a578181015183820152602001610632565b50505050905090810190601f1680156106775780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060018054600160a060020a031916600160a060020a0392909216919091179055565b60008060006106b68461143c565b92506000831180156107455750600160009054906101000a9004600160a060020a0316600160a060020a031663f0320a4f6040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561071657600080fd5b505af115801561072a573d6000803e3d6000fd5b505050506040513d602081101561074057600080fd5b505183105b60408051808201909152601281527f4552524f525f57524f4e475f414d4f554e54000000000000000000000000000060208201529015156107cb5760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360008381101561064a578181015183820152602001610632565b506107d461144f565b600160a060020a031633146107e857600080fd5b600154604080517fb110205a000000000000000000000000000000000000000000000000000000008152600260048201529051600160a060020a039092169163b110205a916024808201926020929091908290030181600087803b15801561084f57600080fd5b505af1158015610863573d6000803e3d6000fd5b505050506040513d602081101561087957600080fd5b5051604080517f7b4f4ec30000000000000000000000000000000000000000000000000000000081529051919350600160a060020a03841691637b4f4ec3916004808201926020929091908290030181600087803b1580156108da57600080fd5b505af11580156108ee573d6000803e3d6000fd5b505050506040513d602081101561090457600080fd5b505190506000811180156109185750428111155b604080518082019091526013815260008051602061269a833981519152602082015290151561098c5760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360008381101561064a578181015183820152602001610632565b50600160009054906101000a9004600160a060020a0316600160a060020a031663f0320a4f6040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156109e057600080fd5b505af11580156109f4573d6000803e3d6000fd5b505050506040513d6020811015610a0a57600080fd5b5051604080517f3f6fb60c000000000000000000000000000000000000000000000000000000008152600481018490529051600160a060020a03851691633f6fb60c9160248083019260209291908290030181600087803b158015610a6e57600080fd5b505af1158015610a82573d6000803e3d6000fd5b505050506040513d6020811015610a9857600080fd5b5051604080518082019091526013815260008051602061269a83398151915260208201529114610b0d5760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360008381101561064a578181015183820152602001610632565b5081600160a060020a031663c0d27d1f82856040518363ffffffff1660e060020a0281526004018083815260200182815260200192505050602060405180830381600087803b158015610b5f57600080fd5b505af1158015610b73573d6000803e3d6000fd5b505050506040513d6020811015610b8957600080fd5b5051604080518082019091526013815260008051602061269a8339815191526020820152901515600114610c025760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360008381101561064a578181015183820152602001610632565b507f5abbb1671b6d9c650007a3cbec015f5e52fc88a370271f595971b30cde568a7b846040518080602001828103825283818151815260200191508051906020019080838360005b83811015610c62578181015183820152602001610c4a565b50505050905090810190601f168015610c8f5780820380516001836020036101000a031916815260200191505b509250505060405180910390a15050505050565b505050565b600081565b600054600160a060020a03163314610cc457600080fd5b8051610cd7906009906020840190612564565b5050565b610ce3610d9f565b565b60085481565b600054600160a060020a03163314610d0257600080fd5b60008054604051600160a060020a03909116917ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482091a260008054600160a060020a0319169055565b60408051808201909152601381527f4552524f525f4e4f545f415641494c41424c4500000000000000000000000000602082015281565b600154600160a060020a031681565b600054600160a060020a031681565b606080606080606080606080606030600160a060020a031631610df66040805190810160405280600381526020017f55524c0000000000000000000000000000000000000000000000000000000000815250611645565b1115610ead57604080516020808252604b908201527f4f7261636c697a6520717565727920776173204e4f542073656e742c20706c65818301527f6173652061646420736f6d652045544820746f20636f76657220666f7220746860608201527f6520717565727920666565000000000000000000000000000000000000000000608082015290517ffee95ecae0c8f7f0743ec0ad254c78ab75e5ecca9f1ddcd9f11f9a98124b96bc9181900360a00190a161112b565b6007805460010190556040805160c08101909152609d8082526125fd6020830139604080518082018252601681527f7d2c226e223a312c226d696e223a312c226d6178223a00000000000000000000602080830191909152600980548451601f60026000196101006001861615020190931692909204918201849004840281018401909552808552949d50919b50610f9f938d939291830182828015610f945780601f10610f6957610100808354040283529160200191610f94565b820191906000526020600020905b815481529060010190602001808311610f7757829003601f168201915b50505050508a6118ad565b9650611028600160009054906101000a9004600160a060020a0316600160a060020a031663f0320a4f6040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015610ff757600080fd5b505af115801561100b573d6000803e3d6000fd5b505050506040513d602081101561102157600080fd5b50516118e4565b9550606060405190810160405280603481526020017f2c227265706c6163656d656e74223a747275652c2262617365223a3130247b5b81526020017f6964656e746974795d20227d227d2c226964223a00000000000000000000000081525094506110948787876118ad565b93506110a060036118e4565b92506040805190810160405280601381526020017f247b5b6964656e746974795d20227d227d275d0000000000000000000000000081525091506110e58484846118ad565b90506111296040805190810160405280600681526020017f6e65737465640000000000000000000000000000000000000000000000000000815250826008546119d7565b505b505050505050505050565b60408051808201909152601781527f4552524f525f4e4f5f4143544956455f4c4f5454455259000000000000000000602082015281565b600381565b60408051808201909152601281527f4552524f525f57524f4e475f414d4f554e540000000000000000000000000000602082015281565b60075481565b600054600160a060020a031633146111c657600080fd5b63ffffffff16600855565b60408051808201909152601181527f4552524f525f4e4f5f434f4e5452414354000000000000000000000000000000602082015281565b600054600160a060020a0316331461121f57600080fd5b6105ad81611ddc565b604080518082019091526013815260008051602061269a833981519152602082015281565b600254600160a060020a03161580611277575060025461127590600160a060020a0316611e4c565b155b15611288576112866000611e50565b505b600260009054906101000a9004600160a060020a0316600160a060020a03166338cc48316040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156112db57600080fd5b505af11580156112ef573d6000803e3d6000fd5b505050506040513d602081101561130557600080fd5b5051600354600160a060020a039081169116146113bb57600260009054906101000a9004600160a060020a0316600160a060020a03166338cc48316040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561136f57600080fd5b505af1158015611383573d6000803e3d6000fd5b505050506040513d602081101561139957600080fd5b505160038054600160a060020a031916600160a060020a039092169190911790555b600354604080517fca6ad1e4000000000000000000000000000000000000000000000000000000008152600481018490529051600160a060020a039092169163ca6ad1e49160248082019260009290919082900301818387803b15801561142157600080fd5b505af1158015611435573d6000803e3d6000fd5b5050505050565b6000611449826000611e5a565b92915050565b600254600090600160a060020a0316158061147c575060025461147a90600160a060020a0316611e4c565b155b1561148d5761148b6000611e50565b505b600260009054906101000a9004600160a060020a0316600160a060020a03166338cc48316040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156114e057600080fd5b505af11580156114f4573d6000803e3d6000fd5b505050506040513d602081101561150a57600080fd5b5051600354600160a060020a039081169116146115c057600260009054906101000a9004600160a060020a0316600160a060020a03166338cc48316040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561157457600080fd5b505af1158015611588573d6000803e3d6000fd5b505050506040513d602081101561159e57600080fd5b505160038054600160a060020a031916600160a060020a039092169190911790555b600360009054906101000a9004600160a060020a0316600160a060020a031663c281d19e6040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561161357600080fd5b505af1158015611627573d6000803e3d6000fd5b505050506040513d602081101561163d57600080fd5b505190505b90565b600254600090600160a060020a03161580611672575060025461167090600160a060020a0316611e4c565b155b15611683576116816000611e50565b505b600260009054906101000a9004600160a060020a0316600160a060020a03166338cc48316040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156116d657600080fd5b505af11580156116ea573d6000803e3d6000fd5b505050506040513d602081101561170057600080fd5b5051600354600160a060020a039081169116146117b657600260009054906101000a9004600160a060020a0316600160a060020a03166338cc48316040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561176a57600080fd5b505af115801561177e573d6000803e3d6000fd5b505050506040513d602081101561179457600080fd5b505160038054600160a060020a031916600160a060020a039092169190911790555b6003546040517f524f3889000000000000000000000000000000000000000000000000000000008152602060048201818152855160248401528551600160a060020a039094169363524f388993879383926044909201919085019080838360005b8381101561182f578181015183820152602001611817565b50505050905090810190601f16801561185c5780820380516001836020036101000a031916815260200191505b5092505050602060405180830381600087803b15801561187b57600080fd5b505af115801561188f573d6000803e3d6000fd5b505050506040513d60208110156118a557600080fd5b505192915050565b60606118dc84848460206040519081016040528060008152506020604051908101604052806000815250611fcc565b949350505050565b6060600080828185151561192d5760408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015294506119ce565b8593505b831561194857600190920191600a84049350611931565b826040519080825280601f01601f191660200182016040528015611976578160200160208202803883390190505b5091505060001982015b85156119ca57815160001982019160f860020a6030600a8a0601029184919081106119a757fe5b906020010190600160f860020a031916908160001a905350600a86049550611980565b8194505b50505050919050565b6002546000908190600160a060020a03161580611a065750600254611a0490600160a060020a0316611e4c565b155b15611a1757611a156000611e50565b505b600260009054906101000a9004600160a060020a0316600160a060020a03166338cc48316040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015611a6a57600080fd5b505af1158015611a7e573d6000803e3d6000fd5b505050506040513d6020811015611a9457600080fd5b5051600354600160a060020a03908116911614611b4a57600260009054906101000a9004600160a060020a0316600160a060020a03166338cc48316040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015611afe57600080fd5b505af1158015611b12573d6000803e3d6000fd5b505050506040513d6020811015611b2857600080fd5b505160038054600160a060020a031916600160a060020a039092169190911790555b600354604080517f2ef3accc0000000000000000000000000000000000000000000000000000000081526024810186905260048101918252875160448201528751600160a060020a0390931692632ef3accc9289928892829160640190602086019080838360005b83811015611bca578181015183820152602001611bb2565b50505050905090810190601f168015611bf75780820380516001836020036101000a031916815260200191505b509350505050602060405180830381600087803b158015611c1757600080fd5b505af1158015611c2b573d6000803e3d6000fd5b505050506040513d6020811015611c4157600080fd5b50519050670de0b6b3a76400003a840201811115611c625760009150611dd4565b6003546040517fc51be90f00000000000000000000000000000000000000000000000000000000815260006004820181815260648301879052608060248401908152895160848501528951600160a060020a039095169463c51be90f948794938c938c938c93604481019160a49091019060208801908083838c5b83811015611cf5578181015183820152602001611cdd565b50505050905090810190601f168015611d225780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b83811015611d55578181015183820152602001611d3d565b50505050905090810190601f168015611d825780820380516001836020036101000a031916815260200191505b5096505050505050506020604051808303818588803b158015611da457600080fd5b505af1158015611db8573d6000803e3d6000fd5b50505050506040513d6020811015611dcf57600080fd5b505191505b509392505050565b600160a060020a0381161515611df157600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a360008054600160a060020a031916600160a060020a0392909216919091179055565b3b90565b600061144961222d565b6000828180805b8351811015611faf5783517f300000000000000000000000000000000000000000000000000000000000000090859083908110611e9a57fe5b90602001015160f860020a900460f860020a02600160f860020a03191610158015611f10575083517f390000000000000000000000000000000000000000000000000000000000000090859083908110611ef057fe5b90602001015160f860020a900460f860020a02600160f860020a03191611155b15611f69578115611f2f57851515611f2757611faf565b600019909501945b600a8302925060308482815181101515611f4557fe5b90602001015160f860020a900460f860020a0260f860020a90040383019250611fa7565b8381815181101515611f7757fe5b90602001015160f860020a900460f860020a02600160f860020a031916602e60f860020a021415611fa757600191505b600101611e61565b6000861115611fc15785600a0a830292505b509095945050505050565b6060806060806060806060806000808e98508d97508c96508b95508a94508451865188518a518c51010101016040519080825280601f01601f191660200182016040528015612025578160200160208202803883390190505b50935083925060009150600090505b885181101561209257888181518110151561204b57fe5b90602001015160f860020a900460f860020a02838380600101945081518110151561207257fe5b906020010190600160f860020a031916908160001a905350600101612034565b5060005b87518110156120f45787818151811015156120ad57fe5b90602001015160f860020a900460f860020a0283838060010194508151811015156120d457fe5b906020010190600160f860020a031916908160001a905350600101612096565b5060005b865181101561215657868181518110151561210f57fe5b90602001015160f860020a900460f860020a02838380600101945081518110151561213657fe5b906020010190600160f860020a031916908160001a9053506001016120f8565b5060005b85518110156121b857858181518110151561217157fe5b90602001015160f860020a900460f860020a02838380600101945081518110151561219857fe5b906020010190600160f860020a031916908160001a90535060010161215a565b5060005b845181101561221a5784818151811015156121d357fe5b90602001015160f860020a900460f860020a0283838060010194508151811015156121fa57fe5b906020010190600160f860020a031916908160001a9053506001016121bc565b50909d9c50505050505050505050505050565b60008061224d731d3b2638a7cc9f2cb3d298a3da7a90b67e5506ed611e4c565b11156122be5760028054600160a060020a031916731d3b2638a7cc9f2cb3d298a3da7a90b67e5506ed17905560408051808201909152600b81527f6574685f6d61696e6e657400000000000000000000000000000000000000000060208201526122b690612555565b506001611642565b60006122dd73c03a2615d5efaf5f49f60b7bb6583eaec212fdf1611e4c565b11156123465760028054600160a060020a03191673c03a2615d5efaf5f49f60b7bb6583eaec212fdf117905560408051808201909152600c81527f6574685f726f707374656e33000000000000000000000000000000000000000060208201526122b690612555565b600061236573b7a07bcf2ba2f2703b24c0691b5278999c59ac7e611e4c565b11156123ce5760028054600160a060020a03191673b7a07bcf2ba2f2703b24c0691b5278999c59ac7e17905560408051808201909152600981527f6574685f6b6f76616e000000000000000000000000000000000000000000000060208201526122b690612555565b60006123ed73146500cfd35b22e4a392fe0adc06de1a1368ed48611e4c565b11156124565760028054600160a060020a03191673146500cfd35b22e4a392fe0adc06de1a1368ed4817905560408051808201909152600b81527f6574685f72696e6b65627900000000000000000000000000000000000000000060208201526122b690612555565b6000612475736f485c8bf6fc43ea212e93bbf8ce046c7f1cb475611e4c565b11156124a9575060028054600160a060020a031916736f485c8bf6fc43ea212e93bbf8ce046c7f1cb4751790556001611642565b60006124c87320e12a1f859b3feae5fb2a0a32c18f5a65555bbf611e4c565b11156124fc575060028054600160a060020a0319167320e12a1f859b3feae5fb2a0a32c18f5a65555bbf1790556001611642565b600061251b7351efaf4c8b3c9afbd5ab9f4bbc82784ab6ef8faa611e4c565b111561254f575060028054600160a060020a0319167351efaf4c8b3c9afbd5ab9f4bbc82784ab6ef8faa1790556001611642565b50600090565b8051610cd79060049060208401905b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106125a557805160ff19168380011785556125d2565b828001600101855582156125d2579182015b828111156125d25782518255916020019190600101906125b7565b506125de9291506125e2565b5090565b61164291905b808211156125de57600081556001016125e856005b55524c5d205b276a736f6e2868747470733a2f2f6170692e72616e646f6d2e6f72672f6a736f6e2d7270632f312f696e766f6b65292e726573756c742e72616e646f6d2e646174612e30272c20275c6e7b226a736f6e727063223a22322e30222c226d6574686f64223a2267656e6572617465496e746567657273222c22706172616d73223a7b226170694b6579223a247b5b646563727970745d204552524f525f4143434553535f44454e49454400000000000000000000000000a165627a7a72305820bdcc89c5cec9b1eaad42f2da4496bd3092f41405bbc3fa29cacead3480ce332f0029