<PAGE>
                                                                  Exhibit 10.20
                             CHEMDEX CORPORATION

                         WARRANT PURCHASE AGREEMENT
                         --------------------------

     This Warrant Purchase Agreement (the "Agreement") is made as of July 27,
                                           ---------
1999, by and between Chemdex Corporation, a Delaware corporation (the "Company")
                                                                       -------
and ALZA Corporation (the "Purchaser").
                           ---------

                                  RECITALS
                                  --------

  The Company and Purchaser are negotiating a lease agreement (the "Lease
                                                                    -----
Agreement") with respect to properties in Mountain View, California located at
---------
1500 & 1550 Plymouth and 1010 Joaquin (the "Properties").  In consideration for
                                            ----------
the continued good faith negotiation of the Lease Agreement and the right to
negotiate exclusively granted herein, the Company desires to issue and the
Purchaser desires to receive a warrant to purchase Common Stock of the Company
in substantially the form attached to this Agreement as Exhibit A (the
                                                        ---------
"Warrant").  The Warrant and the equity securities issuable upon exercise of the
 -------
Warrant are collectively referred to herein as the "Securities."
                                                    ----------

                                  AGREEMENT
                                  ---------

     In consideration of the mutual promises contained herein and other good and
valuable consideration, receipt of which is hereby acknowledged, the parties to
this Agreement agree as follows:

     1.  Purchase and Sale of Warrant.
         ----------------------------

          (a) Sale and Issuance of Warrant.  Subject to the terms and conditions
              ----------------------------
of this Agreement, the Purchaser agrees to receive at the Closing and the
Company agrees to issue to the Purchaser a Warrant to purchase 25,000 shares of
Common Stock.

          (b) Closing; Delivery.  The purchase and sale of the Warrant shall
              -----------------
take place at the offices of Venture Law Group, 2775 Sand Hill Road, Menlo Park,
California, at 6:00 a.m., on July 27, 1999, or at such other time and place as
the Company and the Purchaser mutually agree upon, orally or in writing (which
time and place are designated as the "Closing").  At the Closing, the Company
                                      -------
shall deliver to the Purchaser the Warrant.

     2.  Representations and Warranties of the Company.  The Company hereby
         ---------------------------------------------
represents and warrants to the Purchaser that:

          (a) Organization, Good Standing and Qualification.  The Company is a
              ---------------------------------------------
corporation duly organized, validly existing and in good standing under the laws
of the State of Delaware and has all requisite corporate power and authority to
carry on its business as now conducted and as proposed to be conducted.

          (b) Authorization.  All corporate action on the part of the Company,
              -------------
its officers, directors and stockholders necessary for the authorization,
execution and delivery of this Agreement and the authorization, sale, issuance
and delivery of the Warrant, the shares of the Company's capital stock issuable
upon exercise of the Warrant, and the performance of all obligations of the
Company hereunder
<PAGE>

and thereunder has been taken or will be taken prior to the Closing. The
Agreement and the Warrant, when executed and delivered by the Company, shall
constitute valid and legally binding obligations of the Company, enforceable
against the Company in accordance with their terms except as limited by
applicable bankruptcy, insolvency, reorganization, moratorium, fraudulent
conveyance, and other laws of general application affecting enforcement of
creditors' rights generally, as limited by laws relating to the availability
of specific performance, injunctive relief, or other equitable remedies.

     3.  Representations and Warranties of the Purchaser.  The Purchaser hereby
         -----------------------------------------------
represents and warrants to the Company that:

          (a) Purchase Entirely for Own Account.  The Securities to be acquired
              ---------------------------------
by the Purchaser will be acquired for investment for the Purchaser's own
account, not as a nominee or agent, and not with a view to the resale or
distribution of any part thereof, and the Purchaser has no present intention of
selling, granting any participation in, or otherwise distributing the same.  The
Purchaser has not been formed for the specific purpose of acquiring any of the
Securities.

          (b) Disclosure of Information.  The Purchaser is aware of the
              -------------------------
Company's business affairs and financial condition and has acquired sufficient
information about the Company to reach an informed and knowledgeable decision to
acquire the securities.

          (c) Restricted Securities.  The Purchaser understands that the
              ---------------------
Securities have not been, and will not be, registered under the Securities Act,
by reason of a specific exemption from the registration provisions of the
Securities Act which depends upon, among other things, the bona fide nature of
the investment intent and the accuracy of the Purchaser's representations as
expressed herein.  The Purchaser understands that the Securities are "restricted
securities" under applicable U.S. federal and state securities laws and that,
pursuant to these laws, the Purchaser must hold the Securities indefinitely
unless they are registered with the Securities and Exchange Commission and
qualified by state authorities, or an exemption from such registration and
qualification requirements is available.  The Purchaser acknowledges that the
Company has no obligation to register or qualify the Securities for resale.  The
Purchaser further acknowledges that if an exemption from registration or
qualification is available, it may be conditioned on various requirements
including, but not limited to, the time and manner of sale, the holding period
for the Securities, and on requirements relating to the Company which are
outside of the Purchaser's control, and which the Company is under no obligation
and may not be able to satisfy.

          (d) Legends.  The Purchaser understands that the Securities, and any
              -------
securities issued in respect thereof or exchange therefor, may bear one or all
of the following legends:

          (i) "THE SECURITIES REPRESENTED BY THIS CERTIFICATE HAVE NOT BEEN
REGISTERED UNDER THE SECURITIES ACT OF 1933, AND HAVE BEEN ACQUIRED FOR
INVESTMENT AND NOT WITH A VIEW TO, OR IN CONNECTION WITH, THE SALE OR
DISTRIBUTION THEREOF.  NO SUCH SALE OR DISTRIBUTION MAY BE EFFECTED WITHOUT AN
EFFECTIVE REGISTRATION STATEMENT RELATED THERETO OR AN OPINION OF COUNSEL IN A
FORM SATISFACTORY TO THE COMPANY THAT SUCH REGISTRATION IS NOT REQUIRED UNDER
THE SECURITIES ACT OF 1933."

                                      -2-
<PAGE>

          (ii) Any legend required by the Blue Sky laws of any state to the
extent such laws are applicable to the shares represented by the certificate so
legended.

          (e) Accredited Investor.  The Purchaser is an accredited investor as
              -------------------
defined in Rule 501(a) of Regulation D promulgated under the Act.

          (f) Foreign Investors.  If the Purchaser is not a United States person
              -----------------
(as defined by Section 7701(a)(30) of the Internal Revenue Code of 1986, as
amended), the Purchaser hereby represents that it has satisfied itself as to the
full observance of the laws of its jurisdiction in connection with any
invitation to subscribe for the Securities or any use of this Agreement,
including (i) the legal requirements within its jurisdiction for the purchase of
the Securities, (ii) any foreign exchange restrictions applicable to such
purchase, (iii) any governmental or other consents that may need to be obtained
and (iv) the income tax and other tax consequences, if any, that may be relevant
to the purchase, holding, redemption, sale or transfer of the Securities.  The
Purchaser's subscription and payment for, and his or her continued beneficial
ownership of the Securities, will not violate any applicable securities or other
laws of Purchaser's jurisdiction.

     4.   Conditions of the Purchaser's Obligations at Closing.  The obligations
          ----------------------------------------------------
of the Purchaser to the Company under this Agreement are subject to the
fulfillment, on or before the Closing, of each of the following conditions,
unless otherwise waived:

          (a) Representations and Warranties.  The representations and
              ------------------------------
warranties of the Company contained in Section 2 shall be true on and as of the
Closing with the same effect as though such representations and warranties had
been made on and as of the date of the Closing.

          (b) Qualifications.  All authorizations, approvals or permits, if any,
              --------------
of any governmental authority or regulatory body of the United States or of any
state that are required in connection with the lawful issuance and sale of the
Securities pursuant to this Agreement shall be obtained and effective as of the
Closing.

     5.  Conditions of the Company's Obligations at Closing.  The obligations of
         --------------------------------------------------
the Company to the Purchaser under this Agreement are subject to the
fulfillment, on or before the Closing, of each of the following conditions,
unless otherwise waived:

          (a) Representations and Warranties.  The representations and
              ------------------------------
warranties of the Purchaser contained in Section 3 shall be true on and as of
the Closing with the same effect as though such representations and warranties
had been made on and as of the Closing.

          (b) Qualifications.  All authorizations, approvals or permits, if any,
              --------------
of any governmental authority or regulatory body of the United States or of any
state that are required in connection with the lawful issuance and sale of the
Securities pursuant to this Agreement shall be obtained and effective as of the
Closing.

     6.  Lockup Agreement.  The Purchaser agrees in connection with the
         ----------------
Company's initial public offering of securities that it shall execute the form
of Lockup agreement attached hereto as Exhibit B.

                                      -3-
<PAGE>

     7.  Good Faith Negotiation.  The parties agree that they will, in good
         ----------------------
faith, work together to negotiate and execute the Lease Agreement on
substantially the terms and conditions set forth in the letter of intent
previously executed by the parties as promptly as possible.  The parties agree
that they shall negotiate exclusively with each other with respect to the lease
of the Properties at least until August 10, 1999.

     8.  Registration Rights.  The Company agrees that, promptly after the
         -------------------
Closing and in any event prior to 180 days after the Closing, it will use its
reasonable best efforts to grant "piggyback" registration rights with respect to
the shares issuable upon exercise of the Warrant to the Purchaser and shall (1)
recommend to the current holders of registration rights that such holders
execute documents necessary to grant such "piggyback" registration rights and
(2) upon receipt of the required consents of the current holders of registration
rights, grant "piggyback" registration rights in form reasonably satisfactory to
the parties hereto.

     9.  Miscellaneous.
         -------------

          (a) Successors and Assigns.  The terms and conditions of this
              ----------------------
Agreement shall inure to the benefit of and be binding upon the respective
successors and assigns of the parties.  Nothing in this Agreement, express or
implied, is intended to confer upon any party other than the parties hereto or
their respective successors and assigns any rights, remedies, obligations, or
liabilities under or by reason of this Agreement, except as expressly provided
in this Agreement.

          (b) Governing Law.  This Agreement and all acts and transactions
              -------------
pursuant hereto and the rights and obligations of the parties hereto shall be
governed, construed and interpreted in accordance with the laws of the State of
California, without giving effect to principles of conflicts of law.

          (c) Counterparts.  This Agreement may be executed in two or more
              ------------
counterparts, each of which shall be deemed an original and all of which
together shall constitute one instrument.

          (d) Titles and Subtitles.  The titles and subtitles used in this
              --------------------
Agreement are used for convenience only and are not to be considered in
construing or interpreting this Agreement.

          (e) Notices.  Any notice required or permitted by this Agreement shall
              -------
be in writing and shall be deemed sufficient upon receipt, when delivered
personally or by courier, overnight delivery service or confirmed facsimile, or
forty-eight (48) hours after being deposited in the U.S. mail as certified or
registered mail with postage prepaid, if such notice is addressed to the party
to be notified at such party's address or facsimile number as set forth below or
as subsequently modified by written notice.

          (f) Finder's Fee.  Each party represents that it neither is nor will
              ------------
be obligated for any finder's fee or commission in connection with this
transaction.  The Purchaser agrees to indemnify and to hold harmless the Company
from any liability for any commission or compensation in the nature of a
finder's fee (and the costs and expenses of defending against such liability or
asserted liability) for which the Purchaser or any of its officers, employees,
or representatives is responsible.  The Company agrees to indemnify and hold
harmless the Purchaser from any liability for any commission or compensation in
the nature of a finder's fee (and the costs and expenses of defending against
such

                                      -4-
<PAGE>

liability or asserted liability) for which the Company or any of its officers,
employees or representatives is responsible.

          (g) Amendments and Waivers.  Any term of this Agreement may be amended
              ----------------------
or waived only with the written consent of the Company and the Purchaser.  Any
amendment or waiver effected in accordance with this Section 9(g) shall be
binding upon the Purchaser and each transferee of the Securities, each future
holder of all such Securities, and the Company.

          (h) Severability.  If one or more provisions of this Agreement are
              ------------
held to be unenforceable under applicable law, the parties agree to renegotiate
such provision in good faith, in order to maintain the economic position enjoyed
by each party as close as possible to that under the provision rendered
unenforceable.  In the event that the parties cannot reach a mutually agreeable
and enforceable replacement for such provision, then (i) such provision shall be
excluded from this Agreement, (ii) the balance of the Agreement shall be
interpreted as if such provision were so excluded and (iii) the balance of the
Agreement shall be enforceable in accordance with its terms.

          (i) Entire Agreement.  This Agreement, and the documents referred to
              ----------------
herein constitute the entire agreement between the parties hereto pertaining to
the subject matter hereof, and any and all other written or oral agreements
existing between the parties hereto are expressly canceled.

          (j) Corporate Securities Law.  THE SALE OF THE SECURITIES WHICH ARE
              ------------------------
THE SUBJECT OF THIS AGREEMENT HAS NOT BEEN QUALIFIED WITH THE COMMISSIONER OF
CORPORATIONS OF THE STATE OF CALIFORNIA AND THE ISSUANCE OF THE SECURITIES OR
THE PAYMENT OR RECEIPT OF ANY PART OF THE CONSIDERATION THEREFOR PRIOR TO THE
QUALIFICATION IS UNLAWFUL, UNLESS THE SALE OF SECURITIES IS EXEMPT FROM THE
QUALIFICATION BY SECTION 25100, 25102 OR 25105 OF THE CALIFORNIA CORPORATIONS
CODE.  THE RIGHTS OF ALL PARTIES TO THIS AGREEMENT ARE EXPRESSLY CONDITIONED
UPON THE QUALIFICATION BEING OBTAINED UNLESS THE SALE IS SO EXEMPT.

                                      -5-
<PAGE>

     The parties have executed this Warrant Purchase Agreement as of the date
first written above.


                                    COMPANY:

                                    CHEMDEX CORPORATION


                                    By:
                                       ------------------------------------
                                       David P. Perry, President and Chief
                                       Executive Officer

                                    Address: 3950 Fabian Way
                                             Palo Alto, CA  94303

                                    Facsimile Number: (650) 813-0304

                                    PURCHASER:

                                    ALZA CORPORATION


                                    By:
                                       ------------------------------------

                                    Name:
                                         ----------------------------------
                                                      (print)
                                    Title:
                                          ---------------------------------


                SIGNATURE PAGE TO WARRANT PURCHASE AGREEMENT
<PAGE>

                                  EXHIBIT A
                                  ---------

                               FORM OF WARRANT
<PAGE>

                                  EXHIBIT B
                                  ---------

                          FORM OF LOCKUP AGREEMENT

<PAGE>


                                                                     Exhibit A

THE SECURITIES REPRESENTED BY THIS CERTIFICATE HAVE NOT BEEN REGISTERED UNDER
THE SECURITIES ACT OF 1933, AND HAVE BEEN ACQUIRED FOR INVESTMENT AND NOT WITH A
VIEW TO, OR IN CONNECTION WITH, THE SALE OR DISTRIBUTION THEREOF.  NO SUCH SALE
OR DISTRIBUTION MAY BE EFFECTED WITHOUT AN EFFECTIVE REGISTRATION STATEMENT
RELATED THERETO OR AN OPINION OF COUNSEL IN A FORM SATISFACTORY TO THE COMPANY
THAT SUCH REGISTRATION IS NOT REQUIRED UNDER THE SECURITIES ACT OF 1933.
--------------------------------------------------------------------------------

Warrant No. CS-4                                 Number of Shares:  25,000
Date of Issuance: July 27, 1999             (subject to adjustment)

                             Chemdex Corporation

                        Common Stock Purchase Warrant
                        -----------------------------

     Chemdex Corporation (the "Company"), for value received, hereby certifies
                               -------
that ALZA Corporation, or its registered assigns (the "Registered Holder"), is
                                                       -----------------
entitled, subject to the terms set forth below, to purchase from the Company, at
any time after the date hereof and on or before the Expiration Date (as defined
in Section 5 below), up to 25,000 shares (as adjusted from time to time pursuant
to the provisions of this Warrant) of Common Stock of the Company, at a purchase
price of $15.00 per share.  The shares purchasable upon exercise of this Warrant
and the purchase price per share, as adjusted from time to time pursuant to the
provisions of this Warrant, are sometimes hereinafter referred to as the
"Warrant Stock" and the "Purchase Price," respectively.
 -------------           --------------

     This Warrant is non-forfeitable and issued pursuant to a Warrant Purchase
Agreement dated July 27, 1999 between the Company and the Registered Holder (the
"Purchase Agreement") and is subject to the terms and conditions of the Purchase
 ------------------
Agreement.

     1.  Exercise.
         --------

          (a) Manner of Exercise.  Subject to the provisions of subsection 1(e)
              ------------------
below, this Warrant may be exercised by the Registered Holder at any time after
the issuance of this Warrant, in whole or in part, by surrendering this Warrant,
with the purchase form appended hereto as Exhibit A duly executed by such
                                          ---------
Registered Holder or by such Registered Holder's duly authorized attorney, at
the principal office of the Company, or at such other office or agency as the
Company may designate, accompanied by payment in full of the Purchase Price
payable in respect of the number of shares of Warrant Stock purchased upon such
exercise.  The Purchase Price may be paid by cash, check, wire transfer or by
the surrender of promissory notes or other instruments representing indebtedness
of the Company to the Registered Holder.

          (b) Effective Time of Exercise.  Each exercise of this Warrant shall
              --------------------------
be deemed to have been effected immediately prior to the close of business on
the day on which this Warrant shall have been surrendered to the Company as
provided in Section 1(a) above.  At such time, the person or persons in whose
name or names any certificates for Warrant Stock shall be issuable upon such
exercise as provided in Section 1(d) below shall be deemed to have become the
holder or holders of record of the Warrant Stock represented by such
certificates.
<PAGE>

          (c)  Net Issue Exercise.
               ------------------

               (i) In lieu of exercising this Warrant in the manner provided
above in Section 1(a), the Registered Holder may elect to receive shares equal
to the value of this Warrant (or the portion thereof being canceled) by
surrender of this Warrant at the principal office of the Company together with
notice of such election in which event the Company shall issue to holder a
number of shares of Common Stock computed using the following formula:

               X =              Y (A - B)
                                ---------
                                    A
Where     X = The number of shares of Common Stock to be issued to the
              Registered Holder.

          Y = The number of shares of Common Stock purchasable under this
              Warrant (at the date of such calculation).

          A = The fair market value of one share of Common Stock (at the date of
              such calculation).

          B = The Purchase Price (as adjusted to the date of such calculation).

               (ii) For purposes of this Section 1(c), the fair market value
of one share of Common Stock on the date of calculation shall mean:

                    (A) if the Company's Common Stock is traded on a
securities exchange or The Nasdaq Stock Market or actively traded over-the-
counter:

                        (1) if the Company's Common Stock is traded on a
securities exchange or The Nasdaq Stock Market, the fair market value shall be
deemed to be the average of the closing prices over the three (3) trading-day
period ending the trading day before date of calculation; or

                        (2) if the Company's Common Stock is actively traded
over-the-counter, the fair market value shall be deemed to be the average of
the closing bid or sales price (whichever is applicable) over the three (3)
trading-day period ending the trading day before the date of calculation; or

                    (B) if (A) is not applicable, the fair market value shall
be at the highest price per share which the Company could obtain on the date
of calculation from a willing buyer (not a current employee or director) for
shares of Common Stock sold by the Company, from authorized but unissued
shares, as determined in good faith by the Board of Directors, unless the
Company is at such time subject to an acquisition as described in Section 6(b)
below, in which case the fair market value per share of Common Stock shall be
deemed to be the value of the consideration per share received by the holders
of such stock pursuant to such acquisition.

          (d) Delivery to Holder.  As soon as practicable after the exercise of
              ------------------
this Warrant in whole or in part, and in any event within ten (10) days
thereafter, the Company at its expense will cause to be issued in the name of,
and delivered to, the Registered Holder, or as such Holder (upon payment by such
Holder of any applicable transfer taxes) may direct:

                                      -2-
<PAGE>

              (i) a certificate or certificates for the number of shares of
Warrant Stock to which such Registered Holder shall be entitled, and

              (ii) in case such exercise is in part only, a new warrant or
warrants (dated the date hereof) of like tenor, calling in the aggregate on
the face or faces thereof for the number of shares of Warrant Stock equal
(without giving effect to any adjustment therein) to the number of such shares
called for on the face of this Warrant minus the number of such shares
purchased by the Registered Holder upon such exercise as provided in Section
1(a) above.

     2.  Adjustments.
         -----------

          (a)  Stock Splits and Dividends.  If outstanding shares of the
               --------------------------
Company's Common Stock shall be subdivided into a greater number of shares or a
dividend in Common Stock shall be paid in respect of Common Stock, the Purchase
Price in effect immediately prior to such subdivision or at the record date of
such dividend shall simultaneously with the effectiveness of such subdivision or
immediately after the record date of such dividend be proportionately reduced.
If outstanding shares of Common Stock shall be combined into a smaller number of
shares, the Purchase Price in effect immediately prior to such combination
shall, simultaneously with the effectiveness of such combination, be
proportionately increased.  When any adjustment is required to be made in the
Purchase Price, the number of shares of Warrant Stock purchasable upon the
exercise of this Warrant shall be changed to the number determined by dividing
(i) an amount equal to the number of shares issuable upon the exercise of this
Warrant immediately prior to such adjustment, multiplied by the Purchase Price
in effect immediately prior to such adjustment, by (ii) the Purchase Price in
effect immediately after such adjustment.

          (b) Reclassification, Etc.  In case of any reclassification or change
              ----------------------
of the outstanding securities of the Company or of any reorganization of the
Company (or any other corporation the stock or securities of which are at the
time receivable upon the exercise of this Warrant) or any consolidation or
merger by the Company with another entity or the conveyance of all or
substantially all of the Company's assets, or any similar corporate
reorganization on or after the date hereof, then and in each such case the
holder of this Warrant, upon the exercise hereof at any time after the
consummation of such reclassification, change, reorganization, merger or
conveyance, shall be entitled to receive, in lieu of the stock or other
securities and property receivable upon the exercise hereof prior to such
consummation, the stock or other securities or property to which such holder
would have been entitled upon such consummation if such holder had exercised
this Warrant immediately prior thereto, all subject to further adjustment as
provided in Section 2(a); and in each such case, the terms of this Section 2
shall be applicable to the shares of stock or other securities properly
receivable upon the exercise of this Warrant after such consummation.

          (c) Adjustment Certificate. When any adjustment is required to be made
              ----------------------
in the Warrant Stock or the Purchase Price pursuant to this Section 2, the
Company shall promptly mail to the Registered Holder a certificate setting forth
(i) a brief statement of the facts requiring such adjustment, (ii) the Purchase
Price after such adjustment and (iii) the kind and amount of stock or other
securities or property into which this Warrant shall be exercisable after such
adjustment.

     3.  Limitations on Transfer.  In addition to any other limitation on
         -----------------------
transfer created by applicable securities laws, the Registered Holder shall
not assign, encumber or dispose of any interest except in compliance with the
provisions below and applicable securities laws.

                                      -3-
<PAGE>

          (a) Unregistered Security.  Each holder of this Warrant acknowledges
              ---------------------
that this Warrant and the Warrant Stock have not been registered under the
Securities Act of 1933, as amended (the "Securities Act"), and agrees not to
                                         --------------
sell, pledge, distribute, offer for sale, transfer or otherwise dispose of this
Warrant or any Warrant Stock issued upon its exercise in the absence of (i) an
effective registration statement under the Act as to this Warrant or such
Warrant Stock and registration or qualification of this Warrant or such Warrant
Stock under any applicable U.S. federal or state securities law then in effect
or (ii) an opinion of counsel, satisfactory to the Company, that such
registration and qualification are not required.  Each certificate or other
instrument for Warrant Stock issued upon the exercise of this Warrant shall bear
a legend substantially to the foregoing effect.

          (b) Transferability. Subject to the provisions of Section 3(a) hereof,
              ---------------
this Warrant and all rights hereunder are transferable, in whole or in part,
upon surrender of the Warrant with a properly executed assignment (in the form
of Exhibit B hereto) at the principal office of the Company; provided, however,
   ---------                                                 --------  -------
that this Warrant may not be transferred in part unless the transferee acquires
the right to purchase at least 10,000 shares (as adjusted pursuant to Section 2)
of Warrant Stock hereunder.

          (d) Warrant Register.   The Company will maintain a register
              ----------------
containing the names and addresses of the Registered Holders of this Warrant.
Until any transfer of this Warrant is made in the warrant register, the Company
may treat the Registered Holder of this Warrant as the absolute owner hereof for
all purposes; provided, however, that if this Warrant is properly assigned in
              --------  -------
blank, the Company may (but shall not be required to) treat the bearer hereof as
the absolute owner hereof for all purposes, notwithstanding any notice to the
contrary.  Any Registered Holder may change such Registered Holder's address as
shown on the warrant register by written notice to the Company requesting such
change.

     4.  No Impairment.  The Company will not, by amendment of its charter or
         -------------
through reorganization, consolidation, merger, dissolution, sale of assets or
any other voluntary action, avoid or seek to avoid the observance or performance
of any of the terms of this Warrant, but will (subject to Section 13 below) at
all times in good faith assist in the carrying out of all such terms and in the
taking of all such action as may be necessary or appropriate in order to protect
the rights of the holder of this Warrant against impairment.

     5.  Termination.  This Warrant (and the right to purchase securities upon
         -----------
exercise hereof) shall terminate upon  the fifth anniversary of the date of this
Warrant (the "Expiration Date").
              ---------------

     6.  Notices of Certain Transactions.  In case:
         -------------------------------

          (a) the Company shall take a record of the holders of its Common Stock
(or other stock or securities at the time deliverable upon the exercise of this
Warrant) for the purpose of entitling or enabling them to receive any dividend
or other distribution, or to receive any right to subscribe for or purchase any
shares of stock of any class or any other securities, or to receive any other
right, to subscribe for or purchase any shares of stock of any class or any
other securities, or to receive any other right, or

          (b) of any capital reorganization of the Company, any reclassification
of the capital stock of the Company, any consolidation or merger of the Company,
any consolidation or merger of the Company with or into another corporation
(other than a consolidation or merger in which the Company is the surviving
entity), or any transfer of all or substantially all of the assets of the
Company, or

                                      -4-
<PAGE>

          (c) of the voluntary or involuntary dissolution, liquidation or
winding-up of the Company,

then, and in each such case, the Company will mail or cause to be mailed to the
Registered Holder of this Warrant a notice specifying, as the case may be, (i)
the date on which a record is to be taken for the purpose of such dividend,
distribution or right, and stating the amount and character of such dividend,
distribution or right, or (ii) the effective date on which such reorganization,
reclassification, consolidation, merger, transfer, dissolution, liquidation or
winding-up is to take place, and the time, if any is to be fixed, as of which
the holders of record of Common Stock (or such other stock or securities at the
time deliverable upon such reorganization, reclassification, consolidation,
merger, transfer, dissolution, liquidation or winding-up) are to be determined.
Such notice shall be mailed at least ten (10) days prior to the record date or
effective date for the event specified in such notice.

     7.  Reservation of Stock.  The Company will at all times reserve and keep
         --------------------
available, solely for the issuance and delivery upon the exercise of this
Warrant, such shares of Warrant Stock and other stock, securities and property,
as from time to time shall be issuable upon the exercise of this Warrant.

     8.  Exchange of Warrants.  Upon the surrender by the Registered Holder of
         --------------------
the Warrant, properly endorsed, to the Company at the principal office of the
Company, the Company will, subject to the provisions of Section 3 hereof, issue
and deliver to or upon the order of such Holder, at the Company's expense, a new
Warrant of like tenor, in the name of such Registered Holder or as such
Registered Holder (upon payment by such Registered Holder of any applicable
transfer taxes) may direct, calling in the aggregate on the face or faces
thereof for the number of shares of Common Stock called for on the face of the
Warrant so surrendered.

     9.  Replacement of Warrants.  Upon receipt of evidence reasonably
         -----------------------
satisfactory to the Company of the loss, theft, destruction or mutilation of
this Warrant and (in the case of loss, theft or destruction) upon delivery of an
indemnity agreement (with surety if reasonably required) in an amount reasonably
satisfactory to the Company, or (in the case of mutilation) upon surrender and
cancellation of this Warrant, the Company will issue, in lieu thereof, a new
Warrant of like tenor.

     10.  Notices.  Any notice required or permitted by this Warrant shall be in
          -------
writing and shall be deemed sufficient upon receipt, when delivered personally
or by courier, overnight delivery service or confirmed facsimile, or forty-eight
(48) hours after being deposited in the regular mail as certified or registered
mail (airmail if sent internationally) with postage prepaid, addressed (a) if to
the Registered Holder, to the address of the Registered Holder most recently
furnished in writing to the Company and (b) if to the Company, to the address
set forth below or subsequently modified by written notice to the Registered
Holder.

     11.  No Rights as Stockholder.  Until the exercise of this Warrant, the
          ------------------------
Registered Holder of this Warrant shall not have or exercise any rights by
virtue hereof as a stockholder of the Company.

     12.  No Fractional Shares.  No fractional shares of Common Stock will be
          --------------------
issued in connection with any exercise hereunder.  In lieu of any fractional
shares which would otherwise be issuable, the Company shall pay cash equal to
the product of such fraction multiplied by the fair market value of one share of
Common Stock on the date of exercise, as determined in good faith by the
Company's Board of Directors.

                                      -5-
<PAGE>

     13.  Amendment or Waiver.  Any term of this Warrant may be amended or
          -------------------
waived only by an instrument in writing signed by the party against which
enforcement of the amendment or waiver is sought.

     14.  Headings.  The headings in this Warrant are for purposes of reference
          --------
only and shall not limit or otherwise affect the meaning of any provision of
this Warrant.

     15.  Governing Law. This Warrant shall be governed, construed and
          -------------
interpreted in accordance with the laws of the State of California, without
giving effect to principles of conflicts of law.

                                      -6-
<PAGE>

                              Chemdex Corporation

                              By:
                                 ----------------------------------------
                                 David P. Perry
                                 President and Chief Executive Officer

                              Address:  3950 Fabian Way
                                        Palo Alto, CA 94303

                              Fax Number:  (650) 813-0304

AGREED AND ACCEPTED:

ALZA CORPORATION

By:
   -------------------------------

Name:
     -----------------------------

Title:
      ----------------------------

Address:

Fax Number:

               SIGNATURE PAGE TO COMMON STOCK PURCHASE WARRANT
<PAGE>

                                  EXHIBIT A
                                  ---------

                                PURCHASE FORM
                                -------------

To:  Chemdex Corporation                                    Dated:

     The undersigned, pursuant to the provisions set forth in the attached
Warrant No. CS-4, hereby irrevocably elects to purchase _______ shares of the
Common Stock covered by such Warrant and herewith makes payment of $_________,
representing the full purchase price for such shares at the price per share
provided for in such Warrant.

     The undersigned acknowledges that it has reviewed the representations and
warranties contained in subsections 3(b)-(f) of the Purchase Agreement (as
defined in the Warrant) and by its signature below hereby makes such
representations and warranties to the Company.  Defined terms contained in such
representations and warranties shall have the meanings assigned to them in the
Purchase Agreement, provided that the term "Purchaser" shall refer to the
                    --------
undersigned and the term "Securities" shall refer to the Warrant Stock.

     The undersigned further acknowledges that it has reviewed the market
standoff provisions set forth in Section 6 of the Purchase Agreement and agrees
to be bound by such provisions.

                                    Signature:
                                              -------------------------------

                                    Name (print):
                                                 ----------------------------

                                    Title (if applic.)
                                                      -----------------------

                                    Company (if applic.):
                                                         --------------------
<PAGE>

                                  EXHIBIT B
                                  ---------

                               ASSIGNMENT FORM
                               ---------------

     FOR VALUE RECEIVED, _________________________________________ hereby sells,
assigns and transfers all of the rights of the undersigned under the attached
Warrant with respect to the number of shares of Common Stock covered thereby set
forth below, unto:

<TABLE>
<CAPTION>
          Name of Assignee                      Address/Fax Number                  No. of Shares
          ----------------                      ------------------                  -------------
<S>                                   <C>                                      <C>



</TABLE>

Dated:                           Signature:
      --------------                       -------------------------

                                           -------------------------

                                 Witness:
                                           -------------------------
<PAGE>

                                                                     Exhibit B

                             CHEMDEX CORPORATION

                              LOCK-UP AGREEMENT

                                                                 July 27, 1999

Morgan Stanley & Co. Incorporated
BancBoston Robertson Stephens Inc.
Volpe Brown Whelan & Company, LLC

Ladies and Gentlemen:

     The undersigned understands that you, as representatives (the
"Representatives") of the several underwriters (the "Underwriters"), have
entered into an Underwriting Agreement with Chemdex Corporation (the "Company")
providing for the public offering (the "Public Offering") by the several
Underwriters, including yourselves, of common stock of the Company (the "Common
Stock").

     In consideration of the Underwriters' agreement to purchase and make the
Public Offering of the Company's Common Stock, and for other good and valuable
consideration receipt of which is hereby acknowledged, the undersigned hereby
agrees, during the period ending one hundred eighty (180) days after the date of
the final Prospectus for the Public Offering (the "Lock-up Period"), not to (1)
offer, pledge, sell, contract to sell, engage in any short sale, sell any option
or contract to purchase, purchase any option or contract to sell, grant any
option, right or warrant to purchase, or otherwise transfer or dispose of,
directly or indirectly, any shares of Common Stock or any securities convertible
into or exercisable or exchangeable for Common Stock, or (2) enter into any swap
or similar agreement that transfers, in whole or in part, the economic risk of
ownership of the Common Stock, whether any such transaction described in clause
(1) or (2) above is to be settled by delivery of Common Stock or such other
securities, in cash or otherwise, without the prior written consent of Morgan
Stanley & Co. Incorporated.  In addition, the undersigned agrees that, without
the prior written consent of Morgan Stanley  & Co. Incorporated on behalf of the
Underwriters, it will not, during the Lock-up Period, make any demand for or
exercise any right with respect to, the registration of any shares of Common
Stock or any security convertible into or exercisable or exchangeable for Common
Stock.

     The undersigned confirms that the agreements of the undersigned are
irrevocable and shall be binding upon the undersigned's legal representatives,
successors and assigns.  The undersigned agrees and consents to the entry of
stop transfer instructions with the Company's transfer agent against the
transfer of securities of the Company held by the undersigned except in
compliance with the terms and conditions of this Agreement.


                              Very truly yours,



                              -----------------------------
                              (Signature)


                              -----------------------------
                              (Print Name)


                              -----------------------------
                              (Print Title if an Entity)